Is it possible to write an application that loops through currently running applications and kills applications that are of the status "not responding"? Has anyone written anything like this ? Thanks for any information.....
Quote from: cman on November 05, 2010, 09:02:02 PM
Is it possible to write an application that loops through currently running applications and kills applications that are of the status "not responding"? Has anyone written anything like this ? Thanks for any information.....
You might be looking for:
IsHungAppWindowhttp://msdn.microsoft.com/en-us/library/ms633526%28VS.85%29.aspx
Just open each process, check if its hung and kill it
Thanks for the information! :U I kind of need a basic outline on the algorithm ( like use so and so API to search through a process data structure or whatever , which API to kill the offending processes , etc. ) but thanks for getting me started.
Quote from: cman on November 05, 2010, 09:42:48 PM
Thanks for the information! :U I kind of need a basic outline on the algorithm ( like use so and so API to search through a process data structure or whatever , which API to kill the offending processes , etc. ) but thanks for getting me started.
Since the Hung API uses Hwnd use
EnumWindows:http://msdn.microsoft.com/en-us/library/ms633497%28VS.85%29.aspx
Use
GetWindowThreadProcessID to get the PID of the process with only the Hwnd:
http://msdn.microsoft.com/en-us/library/ms633522%28VS.85%29.aspx
Later use
OpenProcess for open the process (so redundant) with PROCESS_ALL_ACCESS:
Finally use
GetExitCodeProcess and
TerminateProcessPS: You can do thons of other ways :U
I press ctrl+alt+del, then I click tab Applications
it will list all active application who it's caption avail in taskbar
If I close one active application in the taskbar, it will refresh and show remain
active application who it's caption still avail in taskbar
How to detect in our program if we close/open application?
I mean what message (WM_xxxxx) ?
Pardon me for my bad english
thank you
there are several methods to list current running processes. One is to use the EnumProcesses() (http://msdn.microsoft.com/en-us/library/ms682629(v=vs.85).aspx). To see which process has been started or closed you must continual list all running processes and compare results with previous ones.
no, qword.
what I mean is:
I make an app. Then, I run it.
At the other hand, I use WinXP to close/open an application
if I close an app with WinXP, I want to show in my app "WinXP close an app"
if I open an app with WinXP, I want to show in my app "WinXP open an app"
so, my app must detect a message. But, what message (WM_xxxxx) that detact this action?
thank you
elmo,
there is no such message.
To see which application (process) was started/close you must keep track of running processes by listing them continually (e.g. each 0.5-1 second)
Quote from: theunknownguy on November 05, 2010, 09:52:01 PM
Quote from: cman on November 05, 2010, 09:42:48 PM
Thanks for the information! :U I kind of need a basic outline on the algorithm ( like use so and so API to search through a process data structure or whatever , which API to kill the offending processes , etc. ) but thanks for getting me started.
Since the Hung API uses Hwnd use EnumWindows:
http://msdn.microsoft.com/en-us/library/ms633497%28VS.85%29.aspx
Use GetWindowThreadProcessID to get the PID of the process with only the Hwnd:
http://msdn.microsoft.com/en-us/library/ms633522%28VS.85%29.aspx
Later use OpenProcess for open the process (so redundant) with PROCESS_ALL_ACCESS:
Finally use GetExitCodeProcess and TerminateProcess
PS: You can do thons of other ways :U
PROCESS_ALL_ACCESS should not be used, see here:
http://msdn.microsoft.com/en-us/library/ms684880(v=vs.85).aspx
hi elmo,
I just like the idea of receiving messages when process are created or closed,so I've written an little library doing this:
lib: process watcher (http://www.masm32.com/board/index.php?topic=16434.new#new)
qWord
SysInternals Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653) is also good for killing rogue apps,...but, will not do so automatically.
It has the advantage, as Slugsnack has pointed out above, of handling security for you.