Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Classname of exe.

Status
Not open for further replies.

BlackL

Programmer
Dec 1, 2004
1
ZA
HI

I am trying to write a service that checks if another application is still functioning properly. Using Delphi7 the service must check the app every 30 seconds to check the status of the exe - 1) Is the exe running 2)Is the exe hanging.

The first 1) is easy but the second one is the one that I am struglling with.
This is the code that I have:

function IsAppRespondig(Wnd: HWND): Boolean;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
Result := IsAppRespondigNT(wnd)//<--returns true if responding
end;


procedure TService1.Timer1Timer(Sender: TObject);
Var
h: HWND;
dwResult: DWord;
begin
h := FindWindow(PChar('OpusApp'), );//<-- This is the problem = OpusApp is the clasname for Winword.exe.
The classname for the application that was written by myself also in Delphi(the one this service will check) the classname is "TApplication", does all the application written in Delphi have a classname of TApplication and can the classname be changed.

If h <> 0 then
begin
If IsAppRespondig(h) then
Showmessage('App is running ok')
Else
Showmessage('App is hangin');
end;
Else
Showmesagge('Exe not running');
 
Hi,

if you have a form in your app that's allways active, you can search for the classname of your form, like 'TForm1'.
if not, you can always create a hidden dummy form and choose any classname you like...


--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top