471,605 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

knowing which application has focus

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?

Dec 22 '05 #1
1 2166
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]
- mv*@spam.guard.caspershouse.com

"Justin Creasy" <ju***********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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?

Dec 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Laurent | last post: by
2 posts views Thread by yawnmoth | last post: by
7 posts views Thread by Dave Booker | last post: by
7 posts views Thread by marty.overdear | last post: by
5 posts views Thread by NvrBst | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.