I have solved it thanks,

Using:

uses TLHelp32;

procedure KillWowExec ;

var
  hSnapShot: Hwnd ;
  bRet: Boolean ;
  pe32: ProcessEntry32 ;
  bGotModule: Boolean ;
  me32: ModuleEntry32 ;
  Handle: Integer ;

begin
  hSnapShot := CreateToolHelp32SnapShot(TH32CS_SnapProcess, 0) ;
  pe32.dwSize := sizeOf(ProcessEntry32) ;
  if Process32First(hSnapShot, pe32) then
    repeat
      if UpperCase(pe32.szExeFile) = 'NTVDM.EXE' then
      begin
        Handle := OpenProcess(PROCESS_ALL_ACCESS, False, pe32.th32ProcessID)
;
        TerminateProcess(Handle, 0) ;
        CloseHandle(Handle) ;
      end ;
    until not Process32Next(hSnapShot, pe32) ;
end ;

Dave.

-----Original Message-----
From: Nello Sestini [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 September 2000 13:15
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Killing WOWExec


David

I think you may need to PostMessage() the WM_CLOSE messages
because FindWindow may give them to you in the "wrong"
order.

I have a proc that does this by doing an EnumWindows
and posting WM_CLOSE and (AFAIK <g>) it is still working.

(Perhaps I should check it on Win2k!)

ns


-----Original Message-----
From: David O'Brien <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Wednesday, 27 September 2000 05:56
Subject: [DUG]: Killing WOWExec


>I know this has been covered before, but I can't find it.
>
>I need to kill WOWExec. (Sounds simple)
>Sending a WM_Close message doesn't do it, and TerminateProcess doesn't seem
>to do it.
>Running 2000 Pro.
>
>I am trying:
>
>SendMessage(FindWindow(nil, 'WOWExec'), WM_CLOSE, 0, 0) ;
>
>or
>
>TerminateProcess(FindWindow(nil, 'WOWExec')) ;
>
>Is the Hwnd returned in EnumWindows the correct handle to use here?
>Do I need to look at access rights?
>
>The "Window" 'WOWExec' does exist.
>
>any ideas?
>
>Dave.
>---------------------------------------------------------------------------
>    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                  Website: http://www.delphi.org.nz
>To UnSub, send email to: [EMAIL PROTECTED]
>with body of "unsubscribe delphi"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to