Good evening.
How to find out which control has the focus, at the moment?
Thanks in advance
$include "windows.inc"
int controlId = 0 /*focused*/
int hwnd = _GetFocus()
if (hwnd) then controlId = _GetDlgCtrlID(hwnd)QuoteAlthough GetDlgCtrlID may return a value if hwndCtl is a handle to a top-level window, top-level windows cannot have identifiers and such a return value is never valid
Need to try.
I've checked other messages from controls, like @ENCHANGE and @SETKILLFOCUS, that I could eventually use to do the same thing, but in dialogs, @ENCHANGE works as supposed, but @SETKILLFOCUS no...
Thank you!
sapero's method works for me. I can detect which control got the focus in a routine that looks for data entry errors. My problem is that when the user clicks OK when an error exists, I want to cancel that click (i.e., not process the data and close the dialog). I suppose I could use a flg, but is there another way?