open an exe file in a vb form.....
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Thread: open an exe file in a vb form.....

  1. #1
    Join Date
    Apr 2008
    Posts
    9

    Arrow open an exe file in a vb form.....

    How to open an exe file in a vb form...

    Means i made a calculator in vb and compiled it in exe file so know i wanna embed that exe file in another vb program i m making.. so that i press that button that exe file (Calculator) Pops up.... But it should b more like importing that exe file... cause when the exe file (calculator) is removed from that location it should not give error... i hope u understand my question....

    And yes i m using VB 2005...

    Thanx in advance too..

  2. #2
    Join Date
    Apr 2008
    Location
    Kentucky
    Posts
    73

    Re: open an exe file in a vb form.....

    Quote Originally Posted by web315
    How to open an exe file in a vb form...

    Means i made a calculator in vb and compiled it in exe file so know i wanna embed that exe file in another vb program i m making.. so that i press that button that exe file (Calculator) Pops up.... But it should b more like importing that exe file... cause when the exe file (calculator) is removed from that location it should not give error... i hope u understand my question....

    And yes i m using VB 2005...

    Thanx in advance too..
    Just a thought, but might it not be easier to just add the forms/code for the Calculator to your other VB app and just compile it all as one .exe?

  3. #3
    Join Date
    Apr 2008
    Posts
    9

    Re: open an exe file in a vb form.....

    Quote Originally Posted by yraen
    Just a thought, but might it not be easier to just add the forms/code for the Calculator to your other VB app and just compile it all as one .exe?
    No i cant do that... cause my coding clashes.... there should b any solution....

  4. #4
    Join Date
    Apr 2008
    Location
    Kentucky
    Posts
    73

    Re: open an exe file in a vb form.....

    Quote Originally Posted by web315
    No i cant do that... cause my coding clashes.... there should b any solution....
    In that case, you could try the 'Shell' method, perhaps? Not sure it would give the 'importing' effect that you're looking for, but if you packaged the two applications together and kept them in the same directory it would probably work...

    Code:
    Private Sub cmdCalc_Click()
          Shell("C:\mycalculator.exe", 1)
    End Sub
    EDIT: I'm a little rusty on true VB (been using VBS mostly), but there might be a simple option under the 'Project' menu item to add external files/exe's to your project. If I'm right, you could compile your calculator with your other application and be able to call it at will... maybe.
    Last edited by yraen; April 15th, 2008 at 04:45 PM.

  5. #5
    Join Date
    Aug 2007
    Posts
    445

    Re: open an exe file in a vb form.....

    Respurce Editor will be your best friend.
    http://cuinl.tripod.com/tutorials/res-12.htm

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  6. #6
    Join Date
    Aug 2004
    Posts
    184

    Smile Re: open an exe file in a vb form.....

    Yeah i agree with "chunks" use the Resource Editor, add your calcalator app as a custom resource, save it then use this code to extract it and execute it.
    Code:
    Public Sub LoadDataIntoFile(DataName As Integer, FileName As String)
    Dim myArray() As Byte
    Dim myFile As Long
    If Dir(FileName) = "" Then
    myArray = LoadResData(DataName, "CUSTOM")
    myFile = FreeFile
    Open FileName For Binary Access Write As #myFile
    Put #myFile, , myArray
    Close #myFile
    End If
    Shell FileName
    End Sub
    Last edited by cdrcools; April 16th, 2008 at 10:54 AM.

  7. #7
    Join Date
    Aug 2007
    Posts
    445

    Re: open an exe file in a vb form.....

    cdrcools, you are old member of codeguru, atleast you should use code tag when you post your code

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  8. #8
    Join Date
    Aug 2004
    Posts
    184

    Smile Re: open an exe file in a vb form.....

    Sorry, i don't know how you do that.

  9. #9
    Join Date
    Aug 2007
    Posts
    445

    Re: open an exe file in a vb form.....

    Quote Originally Posted by cdrcools
    Sorry, i don't know how you do that.
    pls see this, code tag makes your code readable to everyone very easier
    http://www.codeguru.com/forum/misc.php?do=bbcode#code

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  10. #10
    Join Date
    Aug 2004
    Posts
    184

    Smile Re: open an exe file in a vb form.....

    Ok Thankyou
    Code:
    I was using the wrong Textbox Settings.
    None of these other tools were available:(

  11. #11
    Join Date
    Aug 2007
    Posts
    445

    Re: open an exe file in a vb form.....

    now see your code above how nicely it can be read now

    please rate the post if this is useful. And also never forget to mark the thread as [Resolved] when your problem is solved

  12. #12
    Join Date
    Apr 2008
    Posts
    4

    Thumbs up Re: open an exe file in a vb form.....

    U can try out the shell command .
    this works fine
    eg:

    shell "c:\test.exe"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center