Home > Back-end > For help! Win32 edit control gains focus, how to obtain the enter key message
For help! Win32 edit control gains focus, how to obtain the enter key message
Time:10-11
Function: there are two edit control hMessage, hInput; Including hMessage is read-only mode, which is from the input of hInput show, hInput after the keyboard by pressing ENTER to pass the content of the hInput hMessage,
Setwindowtext, getwindowtext I am understand, but when the cursor is in hInput flashing, press enter, only 1 ring, whether the if (wParam==VK_RETURN & amp; & GetFocus ()==hInput),,, Or POINT p; GetCaretPos (& amp; P); If (wParam==VK_RETURN & amp; & WindowFromPoint (p)==hInput),,, Can't deliver a great god
CodePudding user response:
Set Form1 KeyPreview attribute to true first, and then add the following code in Form1 OnKeyPress events: Void __fastcall Tpassform1: : FormKeyPress (TObject * Sender, char & amp; Key) { If (Key==VK_RETURN) { //work Key=0; } }