10-15-2007, 06:44 AM
EN_SETFOCUS and similar messages are sent by a control to its parent window. They are not real messages, but rather are sent in WM_COMMAND message.
SendMessage hwndParent WM_COMMAND EN_SETFOCUS<<16|idControl hwndControl
For idControl, if you don't know it, use GetDlgCtrlID(hwndControl). Or, if you know id but dont't know hwndControl, use id(idControl) to get hwndControl. Note that you must send message to direct parent window, which not always is top-level window. You can use GetParent(hwndControl) to get direct parent window.
SendMessage hwndParent WM_COMMAND EN_SETFOCUS<<16|idControl hwndControl
For idControl, if you don't know it, use GetDlgCtrlID(hwndControl). Or, if you know id but dont't know hwndControl, use id(idControl) to get hwndControl. Note that you must send message to direct parent window, which not always is top-level window. You can use GetParent(hwndControl) to get direct parent window.