1. There are two steps to process a Keyboard Message: Save the message in the system message queue and put the messages in the application message queue for synchronization. Considering that keyboard input leads to window focus switching, if you put it directly in the application message queue, the window after switching may no longer receive keyboard input.
2. For key combinations that generate printable characters, window will generate a key-hitting message and a character message. For keys that do not generate a character, only a key-hitting message will be generated.
3. wm_keydown may be sent again. wm_keyup occurs only once each time the key is clicked.
4. For all key-hitting messages, wparam is the code that indicates the key to be pressed or released, while lparam contains other data of the key.
5. function key judgment.
Istate = getkeystate (vk_shift );
Istate = getkeystate (vk_capital); // view the status based on the isate location.
6. Reasonable keyboard operations should be performed based on wm_char, wm_deadchar, wm_syschar, and wm_stsdeadchar. wm_keydown messages may cause errors due to differences in keyboard layout. The translatemessage message generates a character message from the wm_keydown message. The wm_char message is clipped between the hit key message. Deadkey can basically be ignored.
For example, the order of messages generated when the key is used is wm_keydown | wm_char | wm_keyup.
7. Rules: If you want to read the keyboard characters entered in the window, process the wm_char message. If you want to read the cursor key and function key, process the wm_keydown message.
8. Insert operator function.
Createcaret, setcaretpos, showcaret, hidecaret, destroycaret, getcaretpos, getcaretblinktime, and setcaretblinktime
A Message Queue supports only one insert character. Therefore, you should not create a caret in the create window to avoid multiple windows. Caret can be easily understood only when the focus is obtained ~~
Hidecaret is accumulative. That is to say, it is necessary to show the number of hide times before launching caret...