>*using ED RAUH api_run class >*can download the zip from UT at : > https://www.levelextreme.com/Report.aspx?Report=11&Numero=9477 > > > >oo=Newobject("api_apprun","process.vcx") > >With oo > .icCommandline="notepad.exe" > .icLaunchDir=Addbs(Justpath(Sys(16,1))) > .icWindowMode='' > .launchApp() > > Inkey(2) &&wait 2sec > If Messagebox("Want to terminate "+.icCommandline +" ?",4+64+4096)=6 > .killProc(.icCommandline) > If !Empty(.icErrorMessage) > Messagebox("ErrorMessage="+.icErrorMessage) > Endi > Endi > > Messagebox( .icCommandline+"terminated with return code="+Trans(.checkprocessexitcode())) >Endwith >>
>run/n notepad >run/n notepad >inke(1) > >LOCAL loWMI, lcQuery, loResult, loProcess >loWMI = GetObject("winmgmts://") >lcQuery= "select * from win32_process where name='notepad.exe'" &&here the exe name application to kill >loResult = loWMI.ExecQuery(lcQuery) >local x >FOR EACH loProcess IN loResult > x=loProcess.Terminate(0) >messagebox("exitcode="+trans(x),0+32+4096,'',1000) >NEXT >Why would you kill a process that could be termunated normally? And how would you get the exitcode if you are killing the process?