Terminate an application from out a service

From: Bert Prins (prinsoft_at_hotmail.com)
Date: 06/21/04


Date: Mon, 21 Jun 2004 15:49:13 +0200

Hallo.

I build a service how starts an application. The same service has to
terminate the same application later on if that application is still
running. I tried the following code, but that doesn't work:

..........
function CloseBatch(Wnd : HWnd) : Boolean; export; stdcall;
   var
     sCap : array [0..255] of char;
   begin
     GetWindowText (Wnd, sCap, sizeof(sCap));
     if pos ('DOB2000 BATCH', UpperCase(sCap)) > 0 then begin
       PostMessage (Wnd, WM_CLOSE, 0, 0);
     end;
     CloseBatch := true;
   end;

begin
   DecodeTime(Now, tHour, tMin, tSec, tMSec);
      // niet verder gaan als DobBackup al draait
      // indien > 20.00 uur dan dobbatch stoppen als die nog loopt
      if (tHour >= 20) then begin
         EnumWindows(@CloseBatch, 0);
         exit;
   end;
.......

Can someone help me?

Bert



Relevant Pages

  • superbly praying Hussein al-Siri
    ... Try not to tremble the oppositions namely, terminate them ideally. ... Zakariya risk that? ... eat normally or Bert will neglect the lentils. ...
    (sci.crypt)
  • Annoying message keeps popping up !!
    ... The system file is not suitable for running MS-DOS and Microsoft Windows ... applications. ... Choose "close" to terminate the application. ... Bert. ...
    (microsoft.public.windowsxp.help_and_support)