Exiting or Terminating a Process with no window
Posted on 2003-02-26
I can use lHwnd = GetWindow(lHwnd, GW_HWNDNEXT) to get the handle to a process's window and then use that handle in either of the following lines of code and it works ok:
bRet = PostMessage(lHwnd, WM_CLOSE, 0&, 0&)
bRet = TerminateProcess(lHwnd, 0)
But how do I exit or terminate a process for which there is no window and I haven't started the process so I don't have any handle?