Page 1 of 1
How to kill a process
Posted: Thu Aug 31, 2006 8:01 pm
by Rafael Clemente
Upon starting an application, I would like to be able to kill a certain process or app that shows in the Task Manager as FtLnSOP.exe. Manually, I can do it by right clicking it and asking "Kill the process tree". Is there any way of achieving the same from the program?
Thanks
Rafael
Re: How to kill a process
Posted: Fri Sep 01, 2006 3:51 am
by wmormar
Rafael Clemente wrote:Upon starting an application, I would like to be able to kill a certain process or app that shows in the Task Manager as FtLnSOP.exe. Manually, I can do it by right clicking it and asking "Kill the process tree". Is there any way of achieving the same from the program?
Thanks
Rafael
Este link te puede servir
Utilizando wmi, se pueden hacer muchas cosillas
Saludos
Posted: Fri Sep 01, 2006 8:37 am
by Frank Demont
Rafael
Here you have an example.
In this example shellexecute starts wordpad with efkes.rtf. The use has to close this aplication first before continuing. If this not occured , the program will do that.
Code: Select all
Shellexecute(0 ,0 , "C:\TEMP\efkes.rtf" ,0 ,0 , 1)
hWnd := FINDWND( "EFKES.RTF" )
? "Atention , wordpad must be closed correctly"
DO WHIL .T.
hWnd := FINDWND( "EFKES.RTF" )
IF ! EMPTY( hWnd )
? "the aplication closes Winword"
SENDMESSAGE( hWnd, 16 )
End
END
Missing FindWnd()
Posted: Fri Sep 01, 2006 11:32 am
by Frank Demont
Code: Select all
// from http://fivetechsoft.com/forums/viewtopic.php?t=1346&start=0&postdays=0&postorder=asc&highlight=findwindow%2A
#define GW_HWNDFIRST 0
#define GW_HWNDLAST 1
#define GW_HWNDNEXT 2
#define GW_HWNDPREV 3
#define GW_OWNER 4
#define GW_CHILD 5
FUNCTION FINDWND( cTitle )
LOCAL hWnd := GETWINDOW( GETDESKTOPWINDOW(), GW_CHILD )
WHILE hWnd != 0
IF UPPER( cTitle ) $ UPPER( GETWINDOWTEXT( hWnd ) )
RETURN hWnd
ENDIF
hWnd = GETWINDOW( hWnd, GW_HWNDNEXT )
ENDDO
RETURN NIL
Posted: Fri Sep 01, 2006 11:43 am
by Rafael Clemente
Frank:
Thank you for your suggestion. The problem is that I do not know the Window title of the program to kill; only its name as it appears in the Task Manager, i.e: "FtLnSOP.exe"
Any other suggestion? _'s sollution seems promising, but at present I have been unabe to compile his example (see Spanish Forum).
Regards,
Rafael
Posted: Fri Sep 01, 2006 12:39 pm
by Antonio Linares
Posted: Sat Sep 02, 2006 7:09 pm
by Silvio
If I must terminate many processes but I not Know how many application are in process, but only these processes not mine program ...
How I can make it ?
Can I have an small sample,pls ?
Posted: Sat Sep 02, 2006 10:18 pm
by Rafael Clemente
Same for me, pls
Rafael
Posted: Sun Sep 03, 2006 8:12 am
by Rafael Clemente
_:
Muchííííísimas gracias. Funciona perfecto. Es justo lo que yo necesitaba
Un saludo
Rafael