Close Programs

BlitzPlus Forums/BlitzPlus Programming/Close Programs

Petron(Posted 2007) [#1]
Does anyone know a way for blitz to close other programs, such as hit this button to open this program; or hit this button to close it. I need this for an emulator I am setting up. Thanks


plash(Posted 2007) [#2]
For killing the Process:
http://www.blitzbasic.com/Community/posts.php?topic=45985

For Obtaining the Process ID (PID):
http://www.blitzbasic.com/codearcs/codearcs.php?code=755


Petron(Posted 2007) [#3]
That is great, but this www.blitzbasic.com/codearcs/codearcs.php?code=755 is a little more than I need. Is there a way to just have something kill the program using the PID if the name is correct, for example if it finds notepad.exe to kill it. Thanks


b32(Posted 2007) [#4]
Maybe the DestroyWindow api ? I never tried it though.
http://msdn2.microsoft.com/en-us/library/ms632682.aspx
It is a user32.dll command. It needs the windows hwnd.


Petron(Posted 2007) [#5]
I think I got it with the previous code that you gave me, thanks; Plash and b32


plash(Posted 2007) [#6]
...is a little more than I need.


Well yeah, I was just giving you an idea of what your looking at here, you could strip down the whole Process list, not store all the process data in a type, and check the process names as they come in until you find the one your looking for.

If DestroyWindow isn't what you thought it was post back and maybe we can work something out.


Petron(Posted 2007) [#7]
Thats what how I got it to work... I think