This example uses the CHARMSG macro to process a WM_CHAR message. It first uses the macro to determine if a key was released. It then uses the macro to generate a switch statement based on the character received.

MRESULT CALLBACK GenericWndProc(hwnd, usMessage, mp1, mp2)

HWND   hwnd;
USHORT usMessage;
MPARAM mp1;
MPARAM mp2;
{

    switch (usMessage) {
    case WM_CHAR:
        if (CHARMSG(&usMessage)->fs & KC_KEYUP) {
            switch (CHARMSG(&usMessage)->chr) {


[Back] [Next]