Click here to Skip to main content
16,021,288 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have to run in VC++ console exe file by manually. It is working fine, but need to run this exe file from C#.net. So, i have to developed the C#.net application in the following code. It is running that exe file but some events not working....

C#.net code:
C#
string command = " -h"; 
System.Diagnostics.Process pRun;
pRun = new System.Diagnostics.Process();
pRun.EnableRaisingEvents = true;
pRun.StartInfo.FileName = @"D:\SMSServer\Srv.exe";
pRun.StartInfo.Arguments = command;
pRun.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;

pRun.Start();
pRun.WaitForExit();

How to rectify this issue?
Posted
Updated 26-Jun-14 1:29am
v2
Comments
CHill60 26-Jun-14 7:28am    
Need lots more detail ... what events are not working?
Sergey Alexandrovich Kryukov 26-Jun-14 13:55pm    
What does it mean, "to rectify a console"? What is that "to run in VC++ console exe file manually"? What is "not manually"? :-)
Did you seriously develop an application with hard-coded file path? What's the use?
What does it mean "some events not working"? What events?! And so on...
—SA
durai.net 26-Jun-14 22:54pm    
Vc++ console exe file is one of the third party application. If i double click that exe then working fine. i mean manually run that application. That application is used to update data to database. so, hard-coded path does't matter because i have read from config file

My problem : i have to develop c#.net application for run vc++ console exe(third party application). It is working but not update data to database.
George Jonsson 26-Jun-14 23:24pm    
Do you start the console application via a shortcut on the desktop?
If so, there might be some command line arguments you are missing when you start the app from code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900