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 ..
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 ..
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
In vb6 you use the App.Path command to return the executable path.