Page 1 of 1
API o Kill a running process
Posted: Wed Dec 26, 2012 6:17 am
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
Re: API o Kill a running process
Posted: Wed Dec 26, 2012 8:27 am
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
Re: API o Kill a running process
Posted: Sat Dec 29, 2012 5:22 am
by unixkd
Hi Ruldof
I could not compile your source code.
Any other better API function, anybody please ?
Joseph
Re: API o Kill a running process
Posted: Mon Dec 31, 2012 7:38 am
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