none
How to add an exe file into my project in Visual Studio 2012?

    Question

  • I have created a Windows project in Visual Studio 2012. This setup file include a push button only that must run an exported exe file from MATLAB GUI. I want to add this exe in my project and i try to export my project. hence, if someone install my project on his desktop, i expect the MATLAB exe file also be installed simultaneously and by clicking on the push button the MATLAB exe file will be run. How can i do this? I appreciate if someone help me.

    Thursday, March 03, 2016 3:48 PM

Answers

  • Let's say your installer installs your program into:

    C:\Program Files (x86)\RussellTrad\Test.exe

    I would expect that the installer would also install the supporting LB_Programming.exe executable into the same folder:

    C:\Program Files (x86)\RussellTrad\LB_Programing.exe

    Then when you launch Test.exe, it's perfectly reasonable for it to expect to find LP_Programming.exe in the same folder as itself.

    The code for Test.exe can call GetModuleFileName(NULL) to retrieve the fully qualified path to its executable "C:\Program Files (x86)\RussellTrad\Test.exe".  Then you can split off just the folder "C:\Program Files (x86)\RussellTrad\" (perhaps with PathCchRemoveFileSpec) and append the other executable name (Using PathCchCombine) to get "C:\Program Files (x86)\RussellTrad\LB_Programing.exe" and launch that.

    • Marked as answer by RussellTrad Saturday, March 05, 2016 1:45 AM
    Friday, March 04, 2016 7:54 PM

All replies

  • This is an installer (setup and deployment) issue.  You must choose a mechanism by which your software is deployed and set up on the user's machine.  This "setup" mechanism must also install any supporting executables and such.

    Is your question then, "How do I create a setup installer program for my software?"

    If you've already chosen a mechanism for installing your program, you should let us know what it is.  The solution to your program depends greatly on what kind of installer you've created.

    Thursday, March 03, 2016 4:16 PM
  • Thank you for your reply.

    I created a software (LP_Programing.exe) by Graphical User Inreface (or GUI) of MATLAB software. After that, i created a software (Test.exe) in Visual Studio 2012 that has a button that must run "LP_Programing". I think i need to create a setup installer for my software. This setup must be able to install both softwares (Test.exe and LP_Programing.exe). I hope I have done what I mean.

    Thursday, March 03, 2016 6:22 PM
  • Thank you for your reply.

    I created a software (LP_Programing.exe) by Graphical User Inreface (or GUI) of MATLAB software. After that, i created a software (Test.exe) in Visual Studio 2012 that has a button that must run "LP_Programing". I think i need to create a setup installer for my software. This setup must be able to install both softwares (Test.exe and LP_Programing.exe). I hope I have done what I mean.

    Hi

    I try to use a command to refer to "LP_Programing" file in my code but i don't know which command can be used to do this?

    I think, the process.start method will doesn't work because this method needs the directory of file whereas the file directory will change after exporting the project. I mean if someone install my software on his desktop, he hasn't the file directory. anyone can help me? thanks.

    Friday, March 04, 2016 5:16 PM
  • Let's say your installer installs your program into:

    C:\Program Files (x86)\RussellTrad\Test.exe

    I would expect that the installer would also install the supporting LB_Programming.exe executable into the same folder:

    C:\Program Files (x86)\RussellTrad\LB_Programing.exe

    Then when you launch Test.exe, it's perfectly reasonable for it to expect to find LP_Programming.exe in the same folder as itself.

    The code for Test.exe can call GetModuleFileName(NULL) to retrieve the fully qualified path to its executable "C:\Program Files (x86)\RussellTrad\Test.exe".  Then you can split off just the folder "C:\Program Files (x86)\RussellTrad\" (perhaps with PathCchRemoveFileSpec) and append the other executable name (Using PathCchCombine) to get "C:\Program Files (x86)\RussellTrad\LB_Programing.exe" and launch that.

    • Marked as answer by RussellTrad Saturday, March 05, 2016 1:45 AM
    Friday, March 04, 2016 7:54 PM
  • Dear Wyck

    your answer was perfect and i appreciate you. thank you very much.

    Saturday, March 05, 2016 9:40 PM