Killing a process on NT without knowing hwnd in VB6
#1
Scooby Regular
Thread Starter
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
Anybody got any ideas how I can kill/terminate a process from within a vb app... I know what the exe is called... just dont know the PID or HWND... as far as I can work out I may need to use PSAPI.DLL...
Or anybody have any ideas how to work out the pid for the app and then kill it??
David
Or anybody have any ideas how to work out the pid for the app and then kill it??
David
#2
Scooby Regular
Join Date: Sep 2000
Location: London
Posts: 7,039
Likes: 0
Received 0 Likes
on
0 Posts
David, I know it's a bit of a bodge but if you run the KILL.EXE that comes with the Resource Kit, you can do call the EXE from VB thus:
KILL <EXE_Name>
You don't need to figure the Process ID with this exe (unlike the Unix version of KILL).
Matt
KILL <EXE_Name>
You don't need to figure the Process ID with this exe (unlike the Unix version of KILL).
Matt
#3
You can walk the windows Z-order and check the window type / name for a match.
Really it's a horrible thing to do, and there is a reason it is so difficult Is it a well known app that you are trying to kill?
KF.
Really it's a horrible thing to do, and there is a reason it is so difficult Is it a well known app that you are trying to kill?
KF.
#4
Scooby Regular
Thread Starter
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
I have written an app to display our computer usage policy and if you dont agree then it logs you off, but I also want to kill the login script which we process using kixtart Kix32.exe (from resource kit...)
David
David
#6
Surely the best way of doing this is rewriting the script?
KF.
EDIT: In fact I am going to be more emphatic. Try the editing script approach first before going around killing processes (yuk).
[Edited by KF - 12/24/2001 1:28:29 AM]
KF.
EDIT: In fact I am going to be more emphatic. Try the editing script approach first before going around killing processes (yuk).
[Edited by KF - 12/24/2001 1:28:29 AM]
#7
Another thing. How is the Use policy application started?
If you are using shell command in the script, the docs state that you are going to be stopping script execution until program exits.
So, you are going to killing the paused, owning process that is controlling the context of the application that is going to kill it. Sucks teeth...
Modify the script. If you want some pointers, just ask.
KF.
If you are using shell command in the script, the docs state that you are going to be stopping script execution until program exits.
So, you are going to killing the paused, owning process that is controlling the context of the application that is going to kill it. Sucks teeth...
Modify the script. If you want some pointers, just ask.
KF.
Trending Topics
#8
Scooby Regular
Thread Starter
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
I know that its not the best way of doing it but... I am assuming that no one is going to disagree!... The exe actually calls the logoff sequence... which in turn will kill the process...
The best way would be use return codes and check for these in the script and then exit... Dont suppose you know how to do that in VB do you??
Cheers
David
The best way would be use return codes and check for these in the script and then exit... Dont suppose you know how to do that in VB do you??
Cheers
David
#9
What I would do is write something to the registry. Start your VB app and use it (the VB app) to write to the registry if the person agrees to the policy. If you use Shell to start the app, just check the key when the script regain control, or use the Run command to launch your app, and set up a loop with a sleep command in it, which polls that registry setting for a change.
Either that or display your usage text using the MessageBox function, and check the return from it.
KF.
Either that or display your usage text using the MessageBox function, and check the return from it.
KF.
#10
Scooby Regular
Thread Starter
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
I was going to display the message using msgbox.. but the policy is like war and peace... so I am using an rtf control... so that hr can change it as they want.. Think you are probably right... will write a reg key under winlogon...
Cheers
David
Cheers
David
Thread
Thread Starter
Forum
Replies
Last Post
Sub-Subaru
General Technical
1
28 September 2015 12:47 PM