Hello,
Gerome,
This works fine, but i wanted to avoid manually clicking. If possible I want to have a program which monitors for these processses and issues this type of command to kill them.
Thanks
-zeemar
Here is a complete and GUI version of my process killer.
It works from Win95b up to Vista Beta 2 version
#Option Explicit
#DllDeclare Kernel32( "CloseHandle", "OpenProcess", "TerminateProcess" )
#DllDeclare User32( "FindWindow", "GetWindowThreadProcessId" )
Const NBSECTOWAITBEFORE = 10
Sub Cleaner()
Fbsl_settext( hLabel, " > Killer @" & Time(1) & ":" & Time(2) & ":" & Time(3) & " <" )
'// Put your program list here: its class name or its caption
Kill( "Notepad", Null )
Kill( "XLMAIN", Null )
End Sub
Function Kill( byVal szClass, byval szCaption ) As Integer
Dim %pid = 0, %hWnd = 0, %hProc = 0, %PROCESS_TERMINATE = 1
hwnd = FindWindow( szClass, szCaption )
If hwnd = 0 Then Return False
GetWindowThreadProcessId( hWnd, @pid )
If pid = 0 Then Return False
hProc = OpenProcess( PROCESS_TERMINATE, False, pid )
If hProc Then
TerminateProcess( hProc, 0 )
CloseHandle( hProc )
Return True
End If
Return False
End Function
Dim %hLabel = FBSL_Control (_
"static", Me, "zzzz", 1000, 20, 20, 170, 20,_
WS_CHILD + SS_LEFT + WS_VISIBLE, WS_EX_TRANSPARENT )
FBSL_SetFont(hLabel, "Arial", 12, FW_BOLD, 0 ,0 ,0)
Fbsl_SetFormColor( Me, RGB(128,0,0) )
Cleaner()
SetTimer( Me, 1000, NBSECTOWAITBEFORE * 1000 )
Resize( Me, 0, 0, 220, 90 )
Fbsl_settext( Me, "Process killer" )
Center(Me)
Show(Me)
Begin Events
Select Case cbmsg
Case wm_timer
Cleaner()
Case wm_close
Killtimer(Me, 1000)
Exitprogram(-1)
End Select
End Events