PDA

Click to See Complete Forum and Search --> : Closing a running program.


n3-Net
May 27th, 2004, 08:20 PM
I am a total nooby at this.

Can someone give me a simple script on how I can close any program running by clicking a button?

I tried

Private Sub Command1_Click()
end ("C:\Program Files\..")
End Sub

But it said syntax error

help please :)

RobDog888
May 29th, 2004, 05:29 PM
Welcome to the vbforums!

This question is probably better suited for the Classic VB forum.

The End method will quit your vb program. No parameters
needed. Usally you would want to unload any objects from
memory before you actuall end your program.

Here is the way to use the End method.
Private Sub Command1_Click()
End
End SubTo end another 3rd party program may not be
the best idea if the program is relying on the user logging out or
something else like closing connections to a database. You would
need to use some APIs to close another programs window like
FindWindow & PostMessage.

:)

manavo11
May 30th, 2004, 03:11 AM
Originally posted by RobDog888

FindWindow & PostMessage.

:)

I would suggest SendMessage if this is the case :)