API o Kill a running process

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

API o Kill a running process

#1 Post by unixkd »

Hi all, Merry Xmas.

I need a function or API to kill a process say "Excel.Exe" before creating Excel object in my application.

Thanks.

Joseph

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: API o Kill a running process

#2 Post by c-tec »

Hi, with the help of OT4XB you can do this way
regards
Rudolf

Code: Select all

#include "ot4xb.ch"

function killapp(cTitle)
******************************************************************
local x,lFound := .f.,aWnd   := WildFindWindow(cTitle)
if len(aWnd) > 0
     for x := 1 to len(aWnd)
          hWndDlg := aWnd[x,1]
          DllCall("User32.dll",DLL_STDCALL,"SendMessageA",hWndDlg,WM_QUIT,0,0)
          lFound := .t.
          exit
     next x
endif
if !lFound
     dc_msgbox(cTitle + " not valid !")
ENDIF
return .t.


static function WildFindWindow( cStr )
******************************************************************
local aWnd     := {}
local pParam   := _xgrab(8)
DEFAULT cStr := ""
PokeDWord( pParam,,{_var2con(aWnd),_var2con(cStr)} )
@user32:EnumWindows(_callback_WildFindWindow_EnumProc(),pParam)
aEval( PeekDWord(pParam,,2) , {|e| _conRelease(e) } )
_xfree(pParam)
return aWnd


Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: API o Kill a running process

#3 Post by unixkd »

Hi Ruldof

I could not compile your source code.

Any other better API function, anybody please ?

Joseph

patito
Posts: 121
Joined: Tue Aug 31, 2010 9:01 pm

Re: API o Kill a running process

#4 Post by patito »

Hi

First you must download the library from this address
then you can compile the example Rudolf
http://www.xbwin.com/
ot4xb - 1.6.0.95 Released
Download Library
Download Source

Hector Pezoa

Post Reply