I have recently created my first application, but i am wanting to put another little application in it, by clicking a command button i want the program to execute, but it will not work, btw i am using VB 6.0
Run Application From within Application
Page 1 of 111 Replies - 57010 Views - Last Post: 30 January 2006 - 10:34 PM
Replies To: Run Application From within Application
#2
Re: Run Application From within Application
Posted 18 January 2006 - 01:01 PM
Can you please provide the code you have written for that command button, along with the name and location of the second application you would like to run?
#3
Re: Run Application From within Application
Posted 18 January 2006 - 02:44 PM
The code for command button
And the second application code
Private Sub Command1_Click() MsgBox "Thank you for trying my product" End Sub
And the second application code
Private Sub cmd5050_Click() MsgBox "There's a 50% chance that I'm crazy, and a 50% chance that you're crazy. And we're leaning towards the latter." End Sub Private Sub cmdAud_Click() MsgBox "After a careful analysis of the audiences poll, we've come to the conclusion that you are a complete moron." End Sub Private Sub cmdCanadian_Click() MsgBox "........................." MsgBox "........................." MsgBox "Eh?" End Sub Private Sub cmdDelete_Click() MsgBox "Delete your hard drive?" End Sub Private Sub cmdFlee_Click() Unload frmLifelines End Sub Private Sub cmdFriend_Click() MsgBox "Admit it, you have no friends" End Sub Private Sub cmdRush_Click() MsgBox "He gave a rather conservative answer that wasn't relative." End Sub Private Sub cmdWitch_Click() MsgBox "We have dispatched the unrluy mob. Prepare to be burned." End Sub Private Sub Form_Load() cmdFlee.SetFocus End Sub
#4
Re: Run Application From within Application
Posted 18 January 2006 - 07:48 PM
Well, the reason it is not working is because you are not calling the second executable in the code for the command button. You need to use the Shell function to run another exe...the following assumes that the second program is called Prog2, and is located in the same directory as the first application:
The exectuable can be anywhere on the machine, you just need to modify the path.
Private Sub Command1_Click()
Shell("Prog2.exe")
End Sub
The exectuable can be anywhere on the machine, you just need to modify the path.
#5
Re: Run Application From within Application
Posted 18 January 2006 - 09:07 PM
Do you just want to execute another application or make it run inside your application?
I think the ShellExecute API used in an MDI Child form might help.
I think the ShellExecute API used in an MDI Child form might help.
#6
Re: Run Application From within Application
Posted 30 January 2006 - 01:11 PM
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim notepadID As Integer = Shell("C:\Program Files\Mozilla Firefox\Firefox.exe", AppWinStyle.NormalFocus)
End Sub
this may give u an idea of how to do it
#7
Re: Run Application From within Application
Posted 30 January 2006 - 02:05 PM
Thanks, i'll try it out
Btw the path of the code i want to use or the path of the finished app i want to add?
Btw the path of the code i want to use or the path of the finished app i want to add?
This post has been edited by Dilerious: 30 January 2006 - 02:07 PM
#8
Re: Run Application From within Application
Posted 30 January 2006 - 02:21 PM
the code will run the app by clicking the button3, i have no idea how to make it run inside of your app, but hopefuly the code might come in usful
This post has been edited by Xions: 30 January 2006 - 02:24 PM
#9
Re: Run Application From within Application
Posted 30 January 2006 - 02:57 PM
vb.net equivalent is
The path you specify is the path of the application you wish to launch...as an FYI, this will not actually run inside your app, but an instance of that app will be launched by yours.
System.Diagnostics.Process.Start("C:\YourExe.exe")
The path you specify is the path of the application you wish to launch...as an FYI, this will not actually run inside your app, but an instance of that app will be launched by yours.
#10
Re: Run Application From within Application
Posted 30 January 2006 - 04:05 PM
Thank you amendeus
But all that code did was open the folder that the app was in, i followed your instructions, i got the path right
What went wrong?
But all that code did was open the folder that the app was in, i followed your instructions, i got the path right
What went wrong?
#11
Re: Run Application From within Application
Posted 30 January 2006 - 06:28 PM
Can you please post the exact code you used?
#12
Re: Run Application From within Application
Posted 30 January 2006 - 10:34 PM
well it could be due to a missing backslash ?"\" <<??
Page 1 of 1

New Topic/Question
Reply



MultiQuote



|