In the message loop, the translatemessage function developer is online builder.com.cn. Updated on:
2007-09-28 Author: Ghost Source: csdn this article keywords: Message loop ghost function Function Description: converts a virtual key message to a character message. The character message is sent to the Message Queue of the calling thread and is read when the next thread calls the getmessage or peekmessage function.
. Function prototype:
Bool translatemessage (const MSG * lpmsg ); . Parameters:
Lpmsg
A pointer to a MSG structure that uses the getmessage or peekmessage function to obtain message information from the message queue of the calling thread. . Return Value:
If the message is converted (that is, the character message is sent to the Message Queue of the thread), a non-zero value is returned.
If the message is wm_keydown, wm_keyup, wm_syskeydown, or wm_syskeyup, a non-zero value is returned, regardless of conversion.
If the message is not converted (that is, the character message is not sent to the Message Queue of the thread), the return value is zero. . Note:
The translatemessage function does not modify the message directed by the lpmsg parameter.
The message wm_keydown and wm_keyup combine to generate a wm_char or wm_deadchar message. Message wm_syskeydown and wm_syskeyup combine to generate a wm_syschar or wm_sysdeadchar message.
Ttanslatemessage only generates wm_char messages for keys mapped to ASCII characters by the keyboard drive.
If the applicationProgramThe translatemessage function should not be called to process virtual key messages for other purposes. For example, if the translateaccelerator function returns a non-zero value, the application will not call the translatemessage function.
Windows CE: Windows CE does not support scan code or extended key flag. Therefore, it does not support the value of lkeydata (lparam) 16-24 in the wm_char message generated by the translatemessage function.
The translatemessage function can only be used to convert messages received by the getmessage or peekmessage function.
From http://www.builder.com.cn/2007/0928/527419.shtml