TranslateMessage

  BOOL TranslateMessage(lpmsg)    
  CONST MSG *lpmsg; /* address of structure with message data */

The TranslateMessage function translates virtual-key messages into character messages, as follows:

WM_KEYDOWN/WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message.

WM_SYSKEYDOWN/WM_SYSKEYUP combinations produce a WM_SYSCHAR or WM_SYSDEADCHAR message.

The character messages are posted to the calling thread's message queue, to be read the next time the thread calls the GetMessage or PeekMessage function.

Parameters

lpmsg

Points to an MSG structure that contains message data retrieved from the calling thread's message queue by using the GetMessage or PeekMessage function. The MSG structure has the following form:

typedef struct tagMSG { /* msg */

HWND hwnd;

UINT message;

WPARAM wParam;

LPARAM lParam;

DWORD time;

POINT pt;

} MSG;

Return Value

The return value is TRUE if the message is translated (that is, a character message is posted to the thread's message queue). Otherwise, it is FALSE.

Comments

The TranslateMessage function does not modify the message pointed to by the lpmsg parameter.

TranslateMessage produces WM_CHAR messages only for keys that are mapped to ASCII characters by the keyboard driver.

An application should not call TranslateMessage if the application processes virtual-key messages for some other purpose. For instance, an application should not call TranslateMessage if the TranslateAccelerator function returns FALSE.

See Also

GetMessage, PeekMessage, TranslateAccelerator