Help With INTERFACING C++.EXE WITH .NET

shreyas123

Member
Joined
Jan 7, 2007
Messages
9
Programming Experience
Beginner
I have written a code in c++ which takes a filename as one of its arguments. This filename I want to pass using .net
How can I do this Please help me
Thank you
 
VB.NET:
Process.Start("cpp.exe", "filename")
 
No, it that code line that starts that process and pass the filename argument.
 
I am not able to run this .exe I have stored in the debug folder and as soon a it starts executing it says "parameters are incorrect"
 
If you able to run the exe from commandline or Run dialog with correct parameters you can do the same thing with Process.Start.
 
It is getting run from the command line but it is not running from the .net I dont know why even when I am double clicking my cpp.exe within that debug folder it is saying "Parameters Are Incorrect"
 
You can't pass command-line parameter to the exe by just doubleclicking the file.
 
I am actually taking a file and putting on it and it is getting run on that file but in the .net it is not even I am applying the main path my .exe then also it is not executing please help me
one more thing i want to interface usb port using .net can I do this and if yes how?
thank you thanks a lot for your concern
 
Ok I go from the start, my cpp.exe file takes one command line filename as a argument, when I drag one file on cpp.exe it gets executed on that file and the output is shown but when I am executing the same cpp.exe with the same filename on the same drive on which I stored this cpp.exe it is showing that "parameters are incorrect" I dont know why..?
 
One thing I'm pretty sure is happening when you drag a file onto the executable from Explorer is that the filename is encapsulated by double-quotes. Are you providing this when setting up the parameter string for Process.Start? It would look like this:
VB.NET:
Process.Start("c:\apps\cpp.exe", """c:\the path\filename.ext""")
or this:
VB.NET:
Dim filename As String = "c:\the path\filename.ext"
Dim param As String = String.Format("""{0}""", filename)
Process.Start("c:\apps\cpp.exe", param)
What happen then is that this correct command is issued:
c:\apps\cpp.exe "c:\the path\filename.ext"
As opposed to this:
c:\apps\cpp.exe c:\the path\filename.ext
..where the space in parameter path would be interpreted as
(param1): "c:\the"
(param2): "path\filename.ext"

Do you see the difference and significance of using quotes in strings?
 
auctually i m providing only one quotes and I am not providing any space in my filepath coz the path doesnt contain any spaces in between..
Well I am trying to write a new vb.net project with the same code but now I am saving it somewhere else lets hope for the best.. Ill let u know what happens
Thanks for replying and for the USB thread

And one more thing are there any handlers in the vb.net for handing I/O interfaces
 
I have created another project and with the same code with te process.start(....) and now it is getting run
Thanks for helping me out
 
Back
Top