kostamania
asked on
Application is running / not running / hang up
How can i find out if an application is running or not
i know only then exe-name (e.g. prg.exe)
i know only then exe-name (e.g. prg.exe)
use windows API
if FindWindow('classname', nil) <> 0 then }return window handle
...
classname in delphi are your main form name or you can use other tool like spy++(visual studio) to get the classname.
alternative
FindWindow(0, 'application title name')
if FindWindow('classname', nil) <> 0 then }return window handle
...
classname in delphi are your main form name or you can use other tool like spy++(visual studio) to get the classname.
alternative
FindWindow(0, 'application title name')
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@anAKiN
in enumstuff is no procedure / function do find the handle of the exe-file
i'm looking for a func. like this
function ExeHandle(prog.exe):Handle
in enumstuff is no procedure / function do find the handle of the exe-file
i'm looking for a func. like this
function ExeHandle(prog.exe):Handle
there is an enum function allowing to get the handle by a exe file name... search once again :-)
ASKER
@anAKiN
i've fond this
function GetExeType(exefile: string) : TExeType;
but where is the handle ?
i've fond this
function GetExeType(exefile: string) : TExeType;
but where is the handle ?
nope :-)
using GetProcessList where every record in result has a name variable, that is the exe file name...
TProcessList = array of record
pid : cardinal;
name : string; // EXE File Name
exeType : TExeType;
threads : TThreadList;
end;
using GetProcessList where every record in result has a name variable, that is the exe file name...
TProcessList = array of record
pid : cardinal;
name : string; // EXE File Name
exeType : TExeType;
threads : TThreadList;
end;
Hi,
There is no such thing like 'exe handle'. There are process handles, thread handles, window handles, etc. What you are looking for (IMHO) is a process handle which corresponds to a specific exe name you know beforehand. You may find one process, many processes or nothing. Nothing and one is OK (easy to handle with) but what if you find many instances of one program running at the same time?
Another point is that 'Not Responding' status simply means that a process haven't managed its message queue for a relatively long period of time. It's not guaranteed that this process is not working anymore. This depends on the programmer who wrote it. Let's suppose that this process has entered in a long and heavy loop and the developer has forgotten to add Application.ProcessMessage s or similar inside that loop. The result is 'Not Responding'.
I agree with anAKiN. Madshi's enumStuff is the best choise to go. It works on all Windows versions.
Regards, Geo
There is no such thing like 'exe handle'. There are process handles, thread handles, window handles, etc. What you are looking for (IMHO) is a process handle which corresponds to a specific exe name you know beforehand. You may find one process, many processes or nothing. Nothing and one is OK (easy to handle with) but what if you find many instances of one program running at the same time?
Another point is that 'Not Responding' status simply means that a process haven't managed its message queue for a relatively long period of time. It's not guaranteed that this process is not working anymore. This depends on the programmer who wrote it. Let's suppose that this process has entered in a long and heavy loop and the developer has forgotten to add Application.ProcessMessage
I agree with anAKiN. Madshi's enumStuff is the best choise to go. It works on all Windows versions.
Regards, Geo
kostamania:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
to accept anAKiN's answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Merry Christmas and happy new year!
kacor
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area for this question:
to accept anAKiN's answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Merry Christmas and happy new year!
kacor
EE Cleanup Volunteer
when you got the handle simply
if SendMessageTimeout(WHandle
ShowMessage('Not responding');
:-)