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;
}
}

CodePudding user response:

reference 1st floor KFRGHT response:
first set Form1 KeyPreview attribute is true, 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;
}
}

You this is a MFC, I am using win32

CodePudding user response:

what MFC, 1/f, is used in the code the VCL class libraries, you said the Win32, mean written in pure SDK window procedure.

CodePudding user response:

reference ccrun reply: 3/f
what MFC, 1/f, VCL library is used in the code, you said the Win32, mean written in pure SDK window procedure,

Well, yes, is the SDK
  • Related