WM of the control in the dialog

zhaozj2021-02-16  56

WM_KEYDOWN message processing of the control in the dialog

In many applications, we have to personalize the controls of the dialog, such as the characters that control the edit box. At this time, we have to mess up WM_KEYDOWN, and the flow of the message is given. Knowing the flow direction of the message know which places can be intercepted.

Can be in Cappdlg :: PretranslateMessage (), CDebuggedit :: PretranslateMessage (), CDebugEdit :: WindowProc (), CDebugEdit :: OnChar (), CDebugEdit :: DefWindowProc () Processing Input Characters, but later must ensure that the previous message stream is running normally Keep returning True after proper processing.

Note: If you use Messagebox in cdebugedit :: onkeyDown (), there is a problem here. You will get the MessageBox prompt in cdebuggedit :: onchar (). This is because there is a message loop when generating a messagebox and acquires the next message from the message loop, which is just from translateMessage (because the message is FIFO, WM_CREATE is still behind). Of course, the Messagebox does not process this message, so it will pop up a MessageBox in cdebugedit :: onchar (). The same truth also accepts WM_KEYUP because the message is issued when MessageBox is generated. The focus window at this time is the MessageBox determination button.

转载请注明原文地址:https://www.9cbs.com/read-27881.html

New Post(0)