-
detect focus
Code:
case WM_COMMAND:
switch(wParam)
{
case EN_SETFOCUS:
MessageBox(NULL,"Edit box has focus", "Focus",MB_OK);
}
I am trying to detect when my editbox has gained focus. Im not sure about the switch statement. Also what is a HIWORD and LOWORD? Thanks
-
What are you not sure about with the switch statements?
HIWORD is the high WORD of a double word (DWORD) type. WORD is 16 bits, and DWORD is 32-bits. If you imagine it in binary, the high word is the left 16 bits, and the low word is the right 16 bits.
-
Is the code working? Here is info on the EN_SETFOCUS message
Code:
EN_SETFOCUS
The EN_SETFOCUS notification message is sent when an edit control receives the keyboard focus. The parent window of the edit control receives this notification message through the WM_COMMAND message.
EN_SETFOCUS
idEditCtrl = (int) LOWORD(wParam); // identifier of edit control
wNotifyCode = HIWORD(wParam); // notification code
hwndEditCtrl = (HWND) lParam; // handle of edit control
-
no the code doesn't work. Im not sure about the first part of the switch statement
What should go where wParam is? Right now when I click in the edit box nothing happens.
-
I think it's meant to be HIWORD(wParam)