knowing which application has focus

J

Justin Creasy

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?
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

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

Similar Threads


Top