Click to See Complete Forum and Search --> : Using the Shell command
rvlopez
January 13th, 2000, 03:59 PM
I would like to know if anyone has a good example of a program that calls another exe. Once the exe get teminated, how can you check for this so that the program can then call on another program or perform another task. Any help would be appreciated.
January 13th, 2000, 05:11 PM
This is an example of using Shell to execute Windows Calculator:
private lngGetCalc as Long 'to work with calculator
public Sub LoadCalculator()
Dim lngResult as Long
' Check if Calculator is active
If IsWindow(lngGetCalc) then
Exit Sub
else
lngGetCalc = Shell("calc.exe", 1)
End If
lngResult = SetWindowPos&(lngGetCalc, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE)
End Sub
Vlad
AndyK
January 13th, 2000, 06:18 PM
just type in
Shell "c:\windows\notepad.exe", vbNormalFocus
to run notepad
AndyK
January 13th, 2000, 06:25 PM
Vlad, next time please declare everything, because your code is incomplete :(, these declarations are missing:
public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (byval hwnd as Long, byval hWndInsertAfter as Long, byval x as Long, byval y as Long, byval cx as Long, byval cy as Long, byval wFlags as Long) as Long
public Declare Function IsWindow Lib "user32" Alias "IsWindow" (byval hwnd as Long) as Long
January 13th, 2000, 08:27 PM
this isan easy one dude, if i understand you right, put in the following code for the forms terminate procedure:
shell "C:\whatever\whatever.exe", VbNormalFocus
so that way, when you close your prorgam, it will execute another
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.