|
-
Apr 10th, 2001, 12:42 AM
#1
I want to terminate a process by its process id. I have tried with openprocess() & terminateprocess(). But its not working. I am giving u the code which i tried.
Dim processid As Long
Dim processhandle As Long
Dim lExitCode As Long
processid = Shell("C:\winnt\system32\notepad.exe", vbMinimizedFocus)
processhandle = OpenProcess(PROCESS_ALL_ACCESS, 0&, processid)
GetExitCodeProcess processhandle, lExitCode
TerminateProcess processhandle, lExitCode
Its not working bcos terminateprocess is taking processhandle(it becomes 0 as soon as it opens notepad.exe) , but i want to terminate the notepad.exe . How to do that? Can u help me in this regard?
-
Apr 10th, 2001, 01:26 AM
#2
Hyperactive Member
Why don't you send message a WM_CLOSE to the notepad 
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Apr 10th, 2001, 09:35 AM
#3
Hi tumblingdown,
Its working fine...
Thanx a lot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|