locked
Embedding 3rd party app into a simple VB.net application RRS feed

Answers

  • You can add it as resource then extract it =>

    Dim sExeFile = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData + "\CSVFileView.exe"
    Dim byteExeFile As Byte() = My.Resources.CSVFileView
    My.Computer.FileSystem.WriteAllBytes(sExeFile, byteExeFile, False)
    Process.Start(sExeFile)

    • Marked as answer by -OSD- Wednesday, March 11, 2020 10:01 AM
    Wednesday, February 26, 2020 4:40 PM
  • You can add it as resource then extract it =>

    Dim sExeFile = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData + "\CSVFileView.exe"
    Dim byteExeFile As Byte() = My.Resources.CSVFileView
    My.Computer.FileSystem.WriteAllBytes(sExeFile, byteExeFile, False)
    Process.Start(sExeFile)

    Thanks, I will give it a try in few hours. I would be able to open a file (example: C:\Windows\Temp.csv) using this resource (csvfile).?

    • Marked as answer by -OSD- Thursday, February 27, 2020 9:54 AM
    Wednesday, February 26, 2020 8:56 PM
  • Use the new path of the extracted executable (sExeFile in the test)

    With Process.Start :

    Dim psi As New ProcessStartInfo(sExeFile)
    psi.WindowStyle = ProcessWindowStyle.Maximized
    psi.Arguments = "D:\Temp.csv"
    Process.Start(psi)

    Worked perfectly, thanks again for your efforts.
    • Marked as answer by -OSD- Thursday, February 27, 2020 9:54 AM
    Thursday, February 27, 2020 9:54 AM

All replies

  • I think you can embed a DLL file that needs to be hosted by your program and not a standalone EXE file. The best you can do is deploy this EXE file to the computer and have your program Invoke the this exe program from your program, IMO.

    And maybe you are using the wrong terminology "embedded" and all you mean is that can you to install your program along with this other exe file as an install package. If so, the answer is "yes".

    • Edited by DA924x Wednesday, February 26, 2020 3:53 PM
    Wednesday, February 26, 2020 3:49 PM
  • yeah, currently I am using it as stand-alone and referring the VB app to use it, was looking to combine both into one exe file instead.
    Wednesday, February 26, 2020 3:53 PM
  • yeah, currently I am using it as stand-alone and referring the VB app to use it, was looking to combine both into one exe file instead.
    No, I don't think you can. Your program and this other program that is an exe file type too are standalone programs. And you can't combine them into one exe file that I know about.
    Wednesday, February 26, 2020 3:57 PM
  • You can add it as resource then extract it =>

    Dim sExeFile = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData + "\CSVFileView.exe"
    Dim byteExeFile As Byte() = My.Resources.CSVFileView
    My.Computer.FileSystem.WriteAllBytes(sExeFile, byteExeFile, False)
    Process.Start(sExeFile)

    • Marked as answer by -OSD- Wednesday, March 11, 2020 10:01 AM
    Wednesday, February 26, 2020 4:40 PM
  • Castorix31 solution will work if there are no supporting DLL files.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, February 26, 2020 5:19 PM

  • What I am trying to expand the solution is to finding a way to add a 3rd party .exe into VB application 


    Yea that is tried already since 1980. Persons wanted  to shop other people software as if it was there own. (With this not saying you are trying to do that)

    But the owners of the software did not like that and therefore it has never been allowed. (Maybe  it is possible by completely reverse engineering the program, but not with VB). 


    Success
    Cor

    Wednesday, February 26, 2020 5:58 PM
  • You can add it as resource then extract it =>

    Dim sExeFile = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData + "\CSVFileView.exe"
    Dim byteExeFile As Byte() = My.Resources.CSVFileView
    My.Computer.FileSystem.WriteAllBytes(sExeFile, byteExeFile, False)
    Process.Start(sExeFile)

    Thanks, I will give it a try in few hours. I would be able to open a file (example: C:\Windows\Temp.csv) using this resource (csvfile).?

    • Marked as answer by -OSD- Thursday, February 27, 2020 9:54 AM
    Wednesday, February 26, 2020 8:56 PM
  • Thanks, I will give it a try in few hours. I would be able to open a file (example: C:\Windows\Temp.csv) using this resource (csvfile).?

    I can't see this working if the exe program has dependencies. 

    Wednesday, February 26, 2020 10:33 PM
  • Thanks, I will give it a try in few hours. I would be able to open a file (example: C:\Windows\Temp.csv) using this resource (csvfile).?

    Once it is extracted, it is an exact copy of CSVFileView.exe

    So, yes, it will work like when you double-click on CSVFileView.exe in Explorer...


    Wednesday, February 26, 2020 10:46 PM
  • Thanks, I will give it a try in few hours. I would be able to open a file (example: C:\Windows\Temp.csv) using this resource (csvfile).?

    Once it is extracted, it is an exact copy of CSVFileView.exe

    So, yes, it will work like when you double-click on CSVFileView.exe in Explorer...


    Hi,

    Thanks, I can confirm that with your example .exe program start as it should be, perfect.

    How I can open a file with using this resource? I mean before I was using this shell command to open a file with this program.

    Shell("D:\CSVFileView.exe D:\Temp.csv", AppWinStyle.MaximizedFocus, False, 0)


    • Edited by -OSD- Thursday, February 27, 2020 9:49 AM
    Thursday, February 27, 2020 9:23 AM
  • Use the new path of the extracted executable (sExeFile in the test)

    With Process.Start :

    Dim psi As New ProcessStartInfo(sExeFile)
    psi.WindowStyle = ProcessWindowStyle.Maximized
    psi.Arguments = "D:\Temp.csv"
    Process.Start(psi)

    Thursday, February 27, 2020 9:48 AM
  • Use the new path of the extracted executable (sExeFile in the test)

    With Process.Start :

    Dim psi As New ProcessStartInfo(sExeFile)
    psi.WindowStyle = ProcessWindowStyle.Maximized
    psi.Arguments = "D:\Temp.csv"
    Process.Start(psi)

    Worked perfectly, thanks again for your efforts.
    • Marked as answer by -OSD- Thursday, February 27, 2020 9:54 AM
    Thursday, February 27, 2020 9:54 AM