knowing which application has focus

  • Thread starter Thread starter Justin Creasy
  • Start date Start date
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?
 
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

Show() a form without giving it focus 4
Brakepoints 1
How to find if Application has Focus 3
App in focus? 2
Multiple monitors 1
Process Component %& focus 1
Form lost focus 1
Application Focus 5

Back
Top