Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

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)
0
kostamania
Asked:
kostamania
1 Solution
 
Lukasz LachCommented:
check out the www.madshi.net/enumStuff.zip units
when you got the handle simply

if SendMessageTimeout(WHandle, WM_NULL, 0, 0, SMTO_ABORTIFHUNG, 5000, dw1) = 0 then
ShowMessage('Not responding');

:-)
0
 
jsmugenCommented:
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')
0
 
Lukasz LachCommented:
but he knows exe file name only, FindWindow won't help...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
kostamaniaAuthor Commented:
@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



0
 
Lukasz LachCommented:
there is an enum function allowing to get the handle by a exe file name... search once again :-)
0
 
kostamaniaAuthor Commented:
@anAKiN
i've fond this
function GetExeType(exefile: string) : TExeType;
but where is the handle ?
0
 
Lukasz LachCommented:
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;
0
 
geobulCommented:
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.ProcessMessages 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
0
 
CleanupPingCommented:
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.
0
 
kacorretiredCommented:
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now