Click to See Complete Forum and Search --> : detect focus
MPrestonf12
May 21st, 2001, 06:46 PM
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
HarryW
May 22nd, 2001, 03:28 AM
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.
Vlatko
May 22nd, 2001, 05:36 AM
Is the code working? Here is info on the EN_SETFOCUS message
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
MPrestonf12
May 22nd, 2001, 03:20 PM
no the code doesn't work. Im not sure about the first part of the switch statement
switch(wParam)
What should go where wParam is? Right now when I click in the edit box nothing happens.
HarryW
May 22nd, 2001, 04:07 PM
I think it's meant to be HIWORD(wParam)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.