Hi all,
I am really stumped on this one so really appreciate any help.
I have a .net service which during OnStart creates a Process() to another .NET exe which I want to display a notify icon in the system tray and show a form. However the Main(string[] args) event in the exe is not firing even though the process is started (exe exists as process in Task Manager) All this code works from another Test exe but not the service. (Full Code Below).
Cheers
Stu
*****Service*****
protected override void OnStart(string[] args)
{
System.IO.
StreamWriter sw = new System.IO.StreamWriter(@"C:\CodeDir\KnowledgeAssist\KAClientManager\bin\Debug\Test1.txt", true);
sw.WriteLine(
"0");
try
{
Process notify = new Process();
notify.StartInfo.FileName =
@"C:\CodeDir\KnowledgeAssist\KANotify\bin\Debug\KANotify.exe";
notify.Start();
sw.WriteLine(
"1");
}
catch(Exception ex)
{
sw.WriteLine(ex.Message);
}
sw.Close();
}
*****EXE*****
public static void Main(string[] args)
{
//new TrayIcon();
System.IO.
StreamWriter sw = new System.IO.StreamWriter(@"C:\CodeDir\KnowledgeAssist\KAClientManager\bin\Debug\Test1.txt", true);
sw.WriteLine(
"Main");
sw.Close();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}