Distribute programs without losing the path / path at the time of execution

0

Good evening friends, I have a difficulty, my project is a button that when you click it opens an executable, I want to publish my project together with the program without losing the path at the time of running on another machine ..

    
asked by anonymous 19.06.2015 / 02:56

2 answers

1

Assuming that both executables are in the same folder, you will have to use Directory.GetCurrentDirectory() , an example of a folder structure:

projeto
├── programa.exe
└── resources
    ├── app1.exe
    ├── app2.exe
    └── app3.exe

Having a structure similar to this, you can create a function to call it whenever you run a particular app, for example:

Function ChamarApp(app As String)
    Dim Filename As String

    Filename = Directory.GetCurrentDirectory() & "\resources\" & app

    Shell("Start.exe " & Filename, vbHide)
End Function

To use just call, as in the example:

ChamarApp("app1.exe") 'Chama o primeiro aplicativo
ChamarApp("app2.exe") 'Chama o segundo aplicativo
ChamarApp("app3.exe") 'Chama o terceiro aplicativo
    
19.06.2015 / 05:09
0

In vb6 you use the App.Path command to return the executable path.

    
14.07.2015 / 23:20