|
-
August 8th, 2011, 12:36 AM
#1
[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
-
August 8th, 2011, 01:43 AM
#2
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...
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
August 8th, 2011, 07:49 PM
#3
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)
-
August 8th, 2011, 10:28 PM
#4
Re: [RESOLVED] Problem while calling .exe file from VS2008
Ask the USER to find the folder...
-
August 9th, 2011, 01:27 PM
#5
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 ...
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
August 9th, 2011, 06:46 PM
#6
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|