Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anyone know how to end a task from (using API) VB6? 1

Status
Not open for further replies.

russellbcopeland

Programmer
Apr 26, 2001
113
US
I can get a list of all of the process running using the psapi and the tools calls in the kernel32 but cant seem to kill any of the process I find. I have tried sending a WM_CLOSE and also calling TerminateProcess and have not been able to stop the process from running.

My end goal is to kill a task that I did not start. This task is a windowless task that just shows up under process in the Win2K task manager. It can be ended from there manually.

Any ideas?

Thanks,
Russell
 
If it is a windowless task, sending a WM_CLOSE is no use.
However, TerminateProcess should work, but only if your process-handle has PROCESS_TERMINATE access. Call GetLastError ( ) after TerminateProcess to find out the reason of failure.

Marcel


 
You were correct, I was not requesting PROCESS_TERMINATE access when I opened my handle to the process.

Thanks for your help!
 
Hello,
Instead of using terminateprocess, I want to use Exitprocess
API from VB6.0. Can anyone post the syntax,how to do it?

I want to terminate the wcesmgr.exe and wcescomm.exe.

Thanks for help in Advance !

Regards
Soni
 
ExitProcess kills the current process and all its threads. As far as I know, you can't use it to kill another process.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top