msos2.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CHARMSG (1.2)
                                                      Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
CHARMSG(pmsg)
 
The CHARMSG macro is used to access the WM_CHAR message parameters. This
macro defines a CHARMSG structure pointer, which has the following form:
 
struct _CHARMSG {
    USHORT chr;             /* mp2 */
    USHORT vkey;
    USHORT fs;              /* mp1 */
    UCHAR  cRepeat;
    UCHAR  scancode;
};
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
pmsg       Points to the message received by the application's window
           procedure.
 
Example
 
This example uses the CHARMSG macro to process a WM_CHAR message. First, it
uses the macro to determine whether a key was released, then it uses the
macro to generate a switch statement based on the character received.
 
MRESULT EXPENTRY 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) {
 
See Also
 
CHAR1FROMMP, CHAR2FROMMP, CHAR3FROMMP, CHAR4FROMMP, CHARMSG