Insider1984
Technical User
Hi I have a service that is actively listening for a certain signal and on that signal will launch a regular C# .Net 2.0 Windows Application. I'm using the following code:
Process fwi = new Process();
fwi.StartInfo.FileName = "D:\\MYAPP.exe";
fwi.StartInfo.Arguments = "-a";
fwi.StartInfo.CreateNoWindow = false;
fwi.StartInfo.UseShellExecute = true;
fwi.Start();
The service after the last line will sit in wait mode again and (after putting some sleeps into the code) I was able to attach myself to MYAPP.exe and determine a few things:
1. MessageBoxes anywhere inside the Form's initialization will not work with a weird error:
"Showing a form when the application is not running in
UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application."
So I got rid of them (they were for debugging anyway).... but then the form just never comes up but the application keeps running.
If I launch the application with or without arguments from it's own exe, from cmd etc it works just fine!
Any ideas? The service doesn't need any feedback from the application. It is almost like the Process is being generated under the service's "runtime". I know that my word usage isn't right but hopefully the point is across...
=====================
Insider
4 year 'on the fly' programmer
C, C++, C#, MFC, Basic, Java ASP.NET
Process fwi = new Process();
fwi.StartInfo.FileName = "D:\\MYAPP.exe";
fwi.StartInfo.Arguments = "-a";
fwi.StartInfo.CreateNoWindow = false;
fwi.StartInfo.UseShellExecute = true;
fwi.Start();
The service after the last line will sit in wait mode again and (after putting some sleeps into the code) I was able to attach myself to MYAPP.exe and determine a few things:
1. MessageBoxes anywhere inside the Form's initialization will not work with a weird error:
"Showing a form when the application is not running in
UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application."
So I got rid of them (they were for debugging anyway).... but then the form just never comes up but the application keeps running.
If I launch the application with or without arguments from it's own exe, from cmd etc it works just fine!
Any ideas? The service doesn't need any feedback from the application. It is almost like the Process is being generated under the service's "runtime". I know that my word usage isn't right but hopefully the point is across...
=====================
Insider
4 year 'on the fly' programmer
C, C++, C#, MFC, Basic, Java ASP.NET