Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing another app from an VB app

Status
Not open for further replies.

sxs90

Programmer
Oct 3, 1999
10
US
Any clues to how one can close another application (exe) from within VB ??<br>
<br>

 
If you launch the other app using a return variable you can use SendKey to sen the other an ALT F4 and shut it down.<br>
<br>
To launch another app: (calculator as an example)<br>
<br>
RetCalc = Shell(Environ(&quot;windir&quot;) & &quot;\system32\CALC.EXE&quot;, 1) ' Run Calculator.<br>
<br>
then to close it down:<br>
<br>
'If Calculator running, activate and close it<br>
If RetCalc &lt;&gt; 0 Then<br>
AppActivate RetCalc<br>
SendKeys &quot;%{F4}&quot;, True<br>
End If<br>

 
Thanks for your code. Will try it out and let you know how it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top