Finding the current focused window

G

gilshallem

Hi i am trying to find the handle of the current focused control in
all the running application.
I tried GETFOCUS() but it gave the the handle only of the current
thread

There are 2 options of solving it.
One, is to find an API function that do it.
Secount, is to find a function that detarmin if a control is focused
the i can make a loop checking all the controls.

Please halp me fint one of this functions.

BTW: I allready tried

Function Isfocused(Handle as intptr)
Dim c as control = control.fromhandle(handle)
Return c.focused
End Function

But This works only for .net controls

I have spend hours trying to solve this, Pleeeaaasee help me
 
K

kimiraikkonen

Hi i am trying to find the handle of the current focused control in
all the running application.
I tried GETFOCUS() but it gave the the handle only of the current
thread

There are 2 options of solving it.
One, is to find an API function that do it.
Secount, is to find a function that detarmin if a control is focused
the i can make a loop checking all the controls.

Please halp me fint one of this functions.

BTW: I allready tried

Function Isfocused(Handle as intptr)
Dim c as control = control.fromhandle(handle)
Return c.focused
End Function

But This works only for .net controls

I have spend hours trying to solve this, Pleeeaaasee help me

FindWindow API?
http://www.pinvoke.net/default.aspx/user32/FindWindow.html
 
F

Family Tree Mike

Have you tried Form.ActiveControl.Handle?

FinWindow finds a window handle by class or name or caption but i need
to find the focused window, and i meen the focused control in the
focused window
for exemple the textbox that i corrently typing in..

10X for replaying anyway
 
G

gilshallem

Have you tried Form.ActiveControl.Handle?







- Show quoted text -

ActiveControl gives the focused control only on the current form. i
need a function that gives the focused control on the focused
application.
 
G

gilshallem

Hi i am trying to find the handle of the current focused control in
all the running application.
I tried GETFOCUS() but it gave the the handle only of the current
thread

There are 2 options of solving it.
One, is to find an API function that do it.
Secount, is to find a function that detarmin if a control is focused
the i can make a loop checking all the controls.

Please halp me fint one of this functions.

BTW: I allready tried

Function Isfocused(Handle as intptr)
Dim c as control = control.fromhandle(handle)
Return c.focused
End Function

But This works only for .net controls

I have spend hours trying to solve this, Pleeeaaasee help me

I found a new solution, GetGuiThreadInfo() but this don's work on vista
 

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