Home All Groups Group Topic Archive Search About

Finding the current application which has focus.

Author
11 Mar 2006 12:54 PM
Paul Aspinall
Hi
Does anyone have any code which can be used to find the current application
which has focus?

I want to try to retrieve the application name, or process name from the app
which has current focus.


Thanks

Author
11 Mar 2006 2:37 PM
Michael Nemtsev
Hello Paul,

Use API GetForegroundWindow() function
http://www.pinvoke.net/default.aspx/user32/GetForegroundWindow.html

PA> Hi
PA> Does anyone have any code which can be used to find the current
PA> application
PA> which has focus?
PA> I want to try to retrieve the application name, or process name from
PA> the app which has current focus.
PA>
PA> Thanks
PA>
---
WBR,
Michael  Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Author
13 Mar 2006 2:44 PM
Stoitcho Goutsev (100)
Paul,

There is no managed solution for that. You need to call  GetForegroundWindow
API for example.


--
HTH
Stoitcho Goutsev (100)

Show quote
"Paul Aspinall" <p***@aspy.co.uk> wrote in message
news:jMzQf.140867$DM.85062@fe3.news.blueyonder.co.uk...
> Hi
> Does anyone have any code which can be used to find the current
> application
> which has focus?
>
> I want to try to retrieve the application name, or process name from the
> app
> which has current focus.
>
>
> Thanks
>
>

AddThis Social Bookmark Button