[RESOLVED] Problem while calling .exe file from VS2008
Hi everybody,
I have an issue in my project, and I hope you can help me.
I am programming in both Matlab (Matlab2011a) and Visual Basic (VS2008).
I've created a .exe file from my matlab code. It works well when I click on it with my mouse.
But I need to run it within Visual Basic. I know it's possible to call .exe files with Shell() or Process.Start(), and it works well for files such as firefox.exe or notepad.exe.
However, it doesn't work when I call my own .exe file ...
It's weird because when I look to the Task Manager while trying to call it (within VB), I can see the process starting and ending, but its output doesn't appear.
I hope you've understood my problem, and you'll be able to help me.
Many thanks,
Did
Re: Problem while calling .exe file from VS2008
#1 : Does your Matlab App accept or require any command line arguments..
#2 : How exactly are you calling the App from VS2008 ... (post code please)
lets see if we can sort this one out...
Re: Problem while calling .exe file from VS2008
Hi GremlinSA,
Thanks for your answer.
Finally, i have solved my issue asking to many people in several forums.
The problem was that by default, the working directory for the new process will be the same as the first app. If the new app assumes that its own program folder is the working directory then it will fail to find one or more files.
Here is my final code, it works well. I hope it can help anybody !
Dim callExe As New ProcessStartInfo
callExe.WorkingDirectory = "C:\Documents and Settings\Tobii\Desktop\Outputs Eye-tracking"
callExe.FileName = "FixationFiltering.exe"
Process.Start(callExe)
Re: [RESOLVED] Problem while calling .exe file from VS2008
Ask the USER to find the folder...
Re: [RESOLVED] Problem while calling .exe file from VS2008
Okay - You've marked this resolved however you could still end up with problems once distributed..
It's not advisable to use hardcoded directories ... ESPECIALLY ones related to users desktops..
C:\Documents and Settings\Tobii\Desktop\Outputs Eye-tracking is for the user Tobii..
What if this gets installed on another PC that there is no user Tobii ... it will not work and the user will battle to figure out why...
Rather ask the user to find it the first time your app starts (or if the app cant find it) and store that location either in the Reg or even the App config file..
Or else Put both applications in the same directory (with all supporting files) and you can use Application.startuppath ...
Re: [RESOLVED] Problem while calling .exe file from VS2008
Hi,
Yes of course it won't work if the program is used on another computer. But for my application, it's ok. I'll never use it with another pc.
Thanks for your answers!