
Ending a Process VB4a 32 Bit
I am trying to end a range of processes (all are consoles running
batch files) from VB4, 32 bit, and can't seem to get it to work
correctly.
The code I am using is as follows:
Public Function Remove_All_Processes()
Main.MonitorTimer.Interval = 0
Main.MonitorTimer.Enabled = False
Dim hwnd As Long
hwnd = FindWindow("ConsoleWindowClass", 0&)
While hwnd <> 0
SendMessage hwnd, WM_SYSCOMMAND, 0 + SC_CLOSE, 0&
hwnd = FindWindow("ConsoleWindowClass", 0&)
Wend
End Function
This works on other types of processes, but won't work on Console
Windows.
Can anyone help out here please?
Thanks,
Richard.