On Tue, 15 May 2007 14:37:01 -0700,
ja***@nospam.com
<ja************@discussions.microsoft.comwrote:
When processing the OnGotFocus event, I need to know the window/control
that lost the focus. Is there a way to determint this?
Not sure...nothing explicit is in the GotFocus event args passed in, so it
doesn't look like it.
However, you could override the WndProc for your control, handling the
WM_SETFOCUS message. You get the window handle that lost the focus in
that message (in the wParam), and then can use the Control.FromHandle()
method to get the actual control.
Seems like an odd oversight for the GotFocus event, considering the
underlying window message provides the information you want, *and*
previous Windows API wrappers (eg MFC) provided that information too.
Pete