Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

knowing which application has focus

47 views
Skip to first unread message

Justin Creasy

unread,
Dec 21, 2005, 8:30:43 PM12/21/05
to
I am creating a program to monitor the open applications on a desktop
(kinda like "Applications" tab in the Windows Task Manager). You can
access all of the information you can see in the Task Manager, but I
want to add some functionality.

The main thing I want to be able to do is know which of the
applications currently has focus in Windows. I haven't found anything
in the Process class in .NET. Can anyone think of a way to know which
application currently has focus?

Nicholas Paldino [.NET/C# MVP]

unread,
Dec 21, 2005, 8:36:27 PM12/21/05
to
Justin,

You should be able to call the GetForegroundWindow API function through
the P/Invoke layer to determine which window is in the foreground (and
ultimately, what has the focus).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Justin Creasy" <justin...@gmail.com> wrote in message
news:1135215043.0...@z14g2000cwz.googlegroups.com...

0 new messages