JohnIdol
JohnIdol

Reputation: 50137

How to get On Focus CWindow handle?

Is there any way to get the handle to the control that has focus? I am looking for a way to get the ID of control on focus in my app.

After that it would be easy to get the id with GetDlgCtrlID.

CWnd *pwnd = GetWindowOnFocus(); 
int wID = pwnd->GetDlgCtrlID();

It's the GetWindowOnFocus part that I am missing!

Upvotes: 4

Views: 3967

Answers (1)

Stu Mackellar
Stu Mackellar

Reputation: 11638

Have a look at the static CWnd::GetFocus method.

Upvotes: 4

Related Questions