It looks like the code for the NotifyIcon is not executing.. Here is what I
have:
namespace EPA
{
public class EPAClass : System.ServiceP rocess.ServiceB ase
{
Log log = new Log(); //This is a log writer. It will write
to file any information I send it
private System.Windows. Forms.NotifyIco n notifyIcon1;
public EPAClass()
{
InitializeCompo nent();
}
private void InitializeCompo nent()
{
this.notifyIcon 1 = new
System.Windows. Forms.NotifyIco n(this.componen ts);
this.notifyIcon 1.Text = "EPA Service";
this.notifyIcon 1.Visible = true;
this.notifyIcon 1.Icon = new System.Drawing. Icon(GetType(),
"Svc.ico");
this.notifyIcon 1.Click += new
System.Windows. Forms.MouseEven tHandler(this.n otifyIcon1_Clic k);
}
private void notifyIcon1_Cli ck(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
log.WriteToLog( "Notify Icon Clicked");
}
}
}
I am not getting the log file written.... Not sure why. There is obviously
more code here, but this should be enough to understand my problem.
Thanks!
Andrew Mueller
"Bob Boran" <mc*******@hotm ail.com> wrote in message
news:e$******** ********@tk2msf tngp13.phx.gbl. ..
the correct code for showing the form is
MyForm f = new MyForm();
f.Show();
However, I am unsure how this will work when launching from a Windows
service, as the service is likely to be running as a different user then
the currently logged in user.
"Andrew Mueller" <am******@inste chnet.com> wrote in message
news:uk******** ******@TK2MSFTN GP11.phx.gbl... Hello,
Is there any way to make a form part of a windows service
application and launch it upon double-click of a system tray icon?
I already have the NotifyIcon working and have added an event to it
for the _DoubleClick.
I added a form and tried to open it with:
{Form Name}.ActiveFor m.Show();
I am not sure if that is correct or not... I grew up in the VB world and
that is similar to what I am used to using for code to open a form.
Help?
Thanks!
Andrew