473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Windows Service and notyfication icon...

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

}

}
Feb 14 '06 #1
1 2094
NotifyIcon is a GUI element and needs a window, even if it can be a hidden
window, to process messages. Only services that run with no GUI whatsoever
can be used without the "interact with desktop" setting.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jacek Jurkowski" <pc*****@priv1.onet.pl> wrote in message
news:eD**************@TK2MSFTNGP14.phx.gbl...
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

}

}

Feb 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Lalit | last post by:
Hi Friends, I have developed a Windows service. Now i need icon for this service in systray and context menu fo this icon. Can i do this? With regards, Lalit
6
by: Action | last post by:
I can add a systray icon in normal windows application... but when i do it in windows service, the systray icon just don't show up is that because i don't have any "component" to contain the...
11
by: Andrew Mueller | last post by:
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...
3
by: Mats-Lennart Hansson | last post by:
Hi, I'm having a hard time getting my service to show a sys tray icon. I've tried to create a separate Windows application where I simply add a notification icon to the form. In the OnStart method...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
4
by: juliashah | last post by:
I've developed a windows service that monitors the database and shows icon of a different color depending on the data. To be able to show an icon I have to select the "Allow service to interact...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
1
by: =?Utf-8?B?VzFsZDBuZTc0?= | last post by:
I need to create a Windows Service, which will be hosting a couple of worker classes, each in there own thread. I will be creating a tray Icon (Notify Icon) and a windows form to manage this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.