472,371 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Windows Service & NotifyIcon

I have a NotifyIcon in my Windows Service project and I am trying to

add a ContextMenu to this NotifyIcon or use some of the mouse events.
Everything isn't working. I think so base class of the service
System.ServiceProcess.ServiceBase don't catchWindows messages like mouse or
timer messages. Any Idea?
Thanks,

Artur Kowalski

Nov 15 '05 #1
1 5415
MSDN:
"
a.. Windows Service applications run in a different window station than the
interactive station of the logged-on user. A window station is a secure
object that contains a clipboard, a set of global atoms, and a group of
desktop objects. Because the station of the Windows Service is not an
interactive station, dialog boxes raised from within a Windows Service
application will not be seen and may cause your program to stop responding.
Similarly, error messages should be logged in the Windows event log rather
than raised in the user interface.
The Windows Service classes supported by the .NET Framework do not support
interaction with interactive stations, that is, the logged-on user. The .NET
Framework also does not include classes that represent stations and
desktops. If your Windows Service must interact with other stations, you
will need to access the unmanaged Windows API.

The interaction of the Windows Service with the user or other stations must
be carefully designed to include scenarios such as there being no logged on
user, or the user having an unexpected set of desktop objects. In some
cases, it may be more appropriate to write a Windows application that runs
under the control of the user.

"

So:
1. Why a service? The service is supposed to be a completely automatic piece
of code that services clients. It wrotes events in event log and is
started/stopped via service manager. If you need user interaction why didn't
you design a simple Windows application?
2. Anyhow, if you want to manage the service locally/remotely via a
customised UI, and to issue more than start/stop functionality you have to
find a common repository (message queues, files or whatever) for the
messages send by a Windows app (the UI) that produces requests for the
service, and the service that consumes them.

--
Horatiu Ripa
"Artur Kowalski" <ar******@bsb.pl> wrote in message
news:bl**********@atlantis.news.tpi.pl...
I have a NotifyIcon in my Windows Service project and I am trying to

add a ContextMenu to this NotifyIcon or use some of the mouse events.
Everything isn't working. I think so base class of the service
System.ServiceProcess.ServiceBase don't catchWindows messages like mouse or timer messages. Any Idea?
Thanks,

Artur Kowalski

Nov 15 '05 #2

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

Similar topics

2
by: Rob Y | last post by:
I have a Windows Service created in VB.NET and I'm trying to implement a taskbar icon. I tried using NotifyIcon, but I can only get this to work on a Windows Form. In the Windows Service it...
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
2
by: Andrew Mueller | last post by:
Hello all, I have created a windows service and now I would like to have a configuration page in the system tray. Basically an icon I can click on which will just interact with an XML file. ...
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: Seymen Ertas | last post by:
Hey anyone seen this before ? I followed examples from microsoft and added a notifyicon to my windows service project and i can't get the icon to show up. Here is a checklist of what i have...
1
by: chinimimita.hernandez | last post by:
Does anyone know how windows service work with notifyicon and contextmenu? I was able to run the windows service with notifyicon part but when I inserted the contextmenu command it didn't work....
0
by: Neo | last post by:
I have created a Windows Service that shows a notifyicon in the system tray. I have also created a context menu for the notifyicon and implemented the notifyicons click event. The notifyicon...
1
by: Jacek Jurkowski | last post by:
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...
5
by: sonali_reddy123 | last post by:
Hello all, I am trying to develop an application which will run as a windows service. The application should have Normal options available with service like start, stop and pause but along...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.