|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to monitor which app window is the foreground window?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. Hi,
This can be done through reflection.Find below the link which descrbies how to monitor application. http://www.codeproject.com/useritems/formscapture.asp -- Show quoteIf my answer helped you,then please do press Yes below. Thanks and Regards. Manish Bafna. MCP and MCTS. "Andrew" wrote: > 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. > Hi,
It can be done through WIN32 function GetForeGroundWindow() also.Find below a link which elaborates more on this : http://www.pinvoke.net/default.aspx/user32/GetForegroundWindow.html please do let me know whether relection or getforegroundwindow has helped you -- Show quoteIf my answer helped you,then please do press Yes below. Thanks and Regards. Manish Bafna. MCP and MCTS. "Andrew" wrote: > 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. > 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... Show quote "Manish Bafna" wrote: > Hi, > It can be done through WIN32 function GetForeGroundWindow() also.Find below > a link which elaborates more on this : > http://www.pinvoke.net/default.aspx/user32/GetForegroundWindow.html > please do let me know whether relection or getforegroundwindow has helped you > -- > If my answer helped you,then please do press Yes below. > Thanks and Regards. > Manish Bafna. > MCP and MCTS. > > > > "Andrew" wrote: > > > 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. > > |
|||||||||||||||||||||||