J
Jacek Jurkowski
I would like to make a notyfication icon showing
all the time my service is running ... The problem is
that in implementation above requires to check
"Allow interact with desktop" in service properys
tab to work properly ... Why? How to make my
notyfication visible without doing anything manually?
Here's my code...
#region Using directives
using System;
using System.Data;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
using System.ServiceProcess;
using System.Collections.Generic;
#endregion
namespace Datacomp.FelixService
{
/// <summary>
/// Serwis Windows Felix.
/// </summary>
public partial class FelixService : ServiceBase
{
#region Members
NotifyIcon nI;
#endregion
#region Constructor
/// <summary>
/// Serwis Windows Felix.
/// </summary>
public FelixService()
{
InitializeComponent();
}
#endregion
#region OnStart
/// <summary>
/// Gdy serwis startuje.
/// </summary>
/// <param name="args">Argumenty startu serwisu.</param>
protected override void OnStart(string[] args)
{
nI = new NotifyIcon();
nI.Icon = Properties.Resources.Main;
nI.Text = "Serwis Felix jest uruchomiony...";
nI.Visible = true;
}
#endregion
#region OnStop
/// <summary>
/// Gdy serwis zostaje zatrzymany.
/// </summary>
protected override void OnStop()
{
nI.Visible = false;
nI.Dispose();
nI = null;
}
#endregion
}
}
all the time my service is running ... The problem is
that in implementation above requires to check
"Allow interact with desktop" in service properys
tab to work properly ... Why? How to make my
notyfication visible without doing anything manually?
Here's my code...
#region Using directives
using System;
using System.Data;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
using System.ServiceProcess;
using System.Collections.Generic;
#endregion
namespace Datacomp.FelixService
{
/// <summary>
/// Serwis Windows Felix.
/// </summary>
public partial class FelixService : ServiceBase
{
#region Members
NotifyIcon nI;
#endregion
#region Constructor
/// <summary>
/// Serwis Windows Felix.
/// </summary>
public FelixService()
{
InitializeComponent();
}
#endregion
#region OnStart
/// <summary>
/// Gdy serwis startuje.
/// </summary>
/// <param name="args">Argumenty startu serwisu.</param>
protected override void OnStart(string[] args)
{
nI = new NotifyIcon();
nI.Icon = Properties.Resources.Main;
nI.Text = "Serwis Felix jest uruchomiony...";
nI.Visible = true;
}
#endregion
#region OnStop
/// <summary>
/// Gdy serwis zostaje zatrzymany.
/// </summary>
protected override void OnStop()
{
nI.Visible = false;
nI.Dispose();
nI = null;
}
#endregion
}
}