Shutting Down A Program...

Noah Body
09-12-2000, 03:31 PM
Hello All,
I have found a way to get a list of currently running programs/applications by name.

So how do I shut a particular one or two of them down??

Specifically, on this WIN98 machine, Msgloop and Msg32.

Thanx In Advance,
->Noah
AKA - NoahBody

bwk5502
09-12-2000, 03:53 PM
I'll bet some hackers that write viruses could tell you the answer for this one.

Derek Stone
09-12-2000, 04:49 PM
Well here is the answer:
(and no I am not a hacker)

Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

Example: TerminateProcess GetCurrentProcess, 0

-cl

Noah Body
09-12-2000, 11:55 PM
Thanx, Dude, but that isn't quite it. I need to shut down another process not the current or calling process.

I want a program I can hand a name to like WINWORD.EXE. The program will go out and if there is one of these running, it will grab it's ProcessID and shut the thing down.

So, we have half the answer, who has the rest??

->Noah
AKA - NoahBody

Noah Body
09-12-2000, 11:55 PM
bwk5502-
Dude, your like a waste of my air.

->N

bwk5502
09-13-2000, 12:33 AM
Oops!

Sorry Noah, I did not mean to offend anyone. I guess one doesn't joke with VB programmers. I apologize to everyone, and it won't happen again; not from me.

Bil

Thrasher
09-13-2000, 05:14 AM
Do you have any details for both:

Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

www.vbapi.com doesn't have both api on its database.

thanks

Derek Stone
09-13-2000, 05:55 AM
To find out more about these API functions go to <A HREF="http://www.allapi.com" target="_new">http://www.allapi.com</A> and download their software, it is excellent.
You'll learn about any API function you could think of.
And I apologize for my assuming that you knew how to use other API functions to get the handle of the the window(s) you were trying to close.
If you still need more help after downloading and reading the examples in the app then I'll see if I can get you an example of my own.

-cl

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum