11 Replies - 57010 Views - Last Post: 30 January 2006 - 10:34 PM Rate Topic: -----

#1 Dilerious   User is offline

  • D.I.C Regular
  • member icon

Reputation: 2
  • View blog
  • Posts: 280
  • Joined: 30-December 05

Run Application From within Application

Posted 18 January 2006 - 12:29 PM

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
Is This A Good Question/Topic? 0
  • +

Replies To: Run Application From within Application

#2 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 253
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

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?
Was This Post Helpful? 0
  • +
  • -

#3 Dilerious   User is offline

  • D.I.C Regular
  • member icon

Reputation: 2
  • View blog
  • Posts: 280
  • Joined: 30-December 05

Re: Run Application From within Application

Posted 18 January 2006 - 02:44 PM

The code for command button

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

Was This Post Helpful? 0
  • +
  • -

#4 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 253
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

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:
Private Sub Command1_Click()
Shell("Prog2.exe")
End Sub


The exectuable can be anywhere on the machine, you just need to modify the path.
Was This Post Helpful? 1

#5 born2c0de   User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

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.
Was This Post Helpful? 0
  • +
  • -

#6 Xions   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 16
  • Joined: 26-January 06

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 :P
Was This Post Helpful? 1

#7 Dilerious   User is offline

  • D.I.C Regular
  • member icon

Reputation: 2
  • View blog
  • Posts: 280
  • Joined: 30-December 05

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?

This post has been edited by Dilerious: 30 January 2006 - 02:07 PM

Was This Post Helpful? 0
  • +
  • -

#8 Xions   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 16
  • Joined: 26-January 06

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

Was This Post Helpful? 0
  • +
  • -

#9 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 253
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Run Application From within Application

Posted 30 January 2006 - 02:57 PM

vb.net equivalent is
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.
Was This Post Helpful? 1

#10 Dilerious   User is offline

  • D.I.C Regular
  • member icon

Reputation: 2
  • View blog
  • Posts: 280
  • Joined: 30-December 05

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?
Was This Post Helpful? 0
  • +
  • -

#11 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 253
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Run Application From within Application

Posted 30 January 2006 - 06:28 PM

Can you please post the exact code you used?
Was This Post Helpful? 0
  • +
  • -

#12 Xenon   User is offline

  • Connection failed
  • member icon

Reputation: 9
  • View blog
  • Posts: 1,595
  • Joined: 12-September 05

Re: Run Application From within Application

Posted 30 January 2006 - 10:34 PM

well it could be due to a missing backslash ?"\" <<??
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1