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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AUTORUN . . how to lauch setup.exe from VB app

Status
Not open for further replies.

MikeMCSD

MIS
Jul 12, 2002
107
US
I want to launch a program (written in VB) from a CD
using autorun . . . I have that part:
[autorun]
OPEN=start.exe

then, IN the VB program (start.exe) I want the user to
have 2 options to either run setup.exe or to run the
application from the CD (instead of installing it)

does anyone know how to run an EXE application from
within VB? I don't think CALL or OPEN will work.

I need to put code behind 2 command buttons that will
either run setup.exe or theApp.exe.

thanks


 
You can use the command SHELL to launch an application by passing it the path and name of the app. The following code is a simple demo:

Private Sub Command1_Click()
' This will run windows explorer
Call Shell("C:\WINDOWS\Explorer.EXE", vbNormalFocus)
Unload Me
End Sub

Private Sub Command2_Click()
' This will run notepad
Call Shell("C:\WINDOWS\NOTEPAD.EXE", vbNormalFocus)
Unload Me
End Sub

Putting this code on a form with 2 command buttons, when run will run the program associated with the button clicked, and close your startup form (if necessary). The paramater after the program name (vbNormalFocus) states how the launched application will be displayed. See the VB help file for further detail on the SHELL command.
 
thanks dj . .
this is what I did and it works within VB:

Private Sub Command1_Click()
Call Shell(App.Path + "\START.EXE", vbNormalFocus)
Unload Me
End Sub

I don't know if this will work when put on the CD,
I'll have to try it.
If I put START.EXE in the root directory of the CD,
I guess that would be the directory for the
App.Path.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top