C# CF keep track of last control that had focus

P

pezi

is there an "easy" way to implement this? (any api calls or something) ... i
don't want to add a lostfocus/gotfocus event on every control, because i
have plenty of them in my application

tia
pezi
 
P

Paul G. Tobey [eMVP]

The operating system knows who has the focus. You can P/Invoke GetFocus()
to get the HWND of the focused window in your application. You could build
an index of HWND to window classes or you could enumerate all of your
focusable windows to figure out which one is focused. Why do you need to
know?

Paul T.
 
P

pezi

hm...i'll take a look at that

i have a custom usercontrol and after clicking one of the buttons of this
control, some things according to the selected control should be done and
the control should get back the focus

pezi

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> schrieb im Newsbeitrag news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top