How to monitor which app window is the foreground window?

G

Guest

Hello, friends,

I need to write an assembly (C#.net 2.0 class library) to monitor all
applications
currently running in a PC. Especially, I need to know which window is the top
one, i.e., catch the event when a window becomes foreground window. Should
I use WndProc() to catch related window messages? (I don't want
to use timer).

Any reference paper or sample source code? Thanks a lot.
 
G

Guest

I believe it works when we call GetForeGroundWindow() function. It will
return back the foreground window.

But, I don't want a person or timer get involved on when to call to this
function. This funcitons should be called when certain events are raised,
e.g., WM_ACTIVATE, WM_ACTIVATEAPP, etc., I guess...
 

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

Top