How ro kill a program/process if it is running from within VB6

A

Athena

Hello,

I run a program from within a VB program using shell. After the first
instance of the program, before I call it again, I need to kill it. How can
I do it so that only one instance of the program runs? Thank you.

Athena

Like this:

If DebugFlag = False Then
Kill "AProgram" ' if it is running if not
Shell "AProgram test", vbNormalFocus
End If
 
J

John W. Vinson

Hello,

I run a program from within a VB program using shell. After the first
instance of the program, before I call it again, I need to kill it. How can
I do it so that only one instance of the program runs? Thank you.

Athena

Like this:

If DebugFlag = False Then
Kill "AProgram" ' if it is running if not
Shell "AProgram test", vbNormalFocus
End If

You might want to ask this question in a VB newsgroup; this newsgroup is for
the Microsoft Access database product.

John W. Vinson [MVP]
 
T

Tony Toews [MVP]

Athena said:
I run a program from within a VB program using shell. After the first
instance of the program, before I call it again, I need to kill it. How can
I do it so that only one instance of the program runs? Thank you.

Athena

Like this:

If DebugFlag = False Then
Kill "AProgram" ' if it is running if not
Shell "AProgram test", vbNormalFocus
End If

What program is it? If it supports Automation such as Word or Excel then you can use
methods such as Application.Quit to close it down.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
Top