|
-
January 13th, 2000, 04:59 PM
#1
Using the Shell command
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, 06:11 PM
#2
Re: Using the Shell command
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
-
January 13th, 2000, 07:18 PM
#3
Re: Using the Shell command
just type in
Shell "c:\windows\notepad.exe", vbNormalFocus
to run notepad
-
January 13th, 2000, 07:25 PM
#4
Re: Using the Shell command
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, 09:27 PM
#5
Re: Using the Shell command
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|