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');
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');