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

Clicking on a button to run an executable (.exe). 1

Status
Not open for further replies.

iao

Programmer
Feb 23, 2001
111
US
I work for a company that has a software program built in Visual FoxPro. The program runs via a simple .exe file. So, if you click on the .exe, the program starts.

However, we also are now starting to utilize VB applications.

What I would like to know is this: is it possible to simply add a button on one of the VB apps, so that when you click on it, it runs the specified .exe?

How would I go about doing such a thing? Any ideas as to what would go in the following code to just run a .exe in a specific directory? Please assume that I have already prebuilt into the code the location of the executable file under C:\TestProgram

Option Explicit
Private Sub RunProgram_Button_Click()

End Sub

Thanks so much!!!
 
Note that in vb shell runs async (vb does not wait for the "shelled" program to terminate before continuing it's own execution). If this is a problem there are some examples on the internet of how (using api calls) you can force vb to wait until the shelled program has completed. Alternatively mail me andyrne@yahoo.com & I can send you a dll that'll do it (& source code)

A
 
Or look up Shellandwait
This has been covered recently in this forum - do a search Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top