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 with desktop"
checkbox on the service, and when I do it manually, the icon shows just
fine.
But I want the users to double-click the installation file and not have
to go to the Services and select the checkbox. So I used this example http://www.codeproject.com/csharp/Cs...iceDesktop.asp to check
the checkbox programmaticall y. I found out that it selected the
checkbox, but the icon still doesn't show. But if I go and manually
deselect and select the checkbox, it starts working. So I figured that
piece of code in the example does select the checkbox, but does not
really change the property of the service.
I also tried this:
ServiceControll er sc = new ServiceControll er("MyServiceNa me");
sc.ServiceType = ServiceType.Int eractiveProcess ;
but got an error message:
Property or indexer
'System.Service Process.Service Controller.Serv iceType' cannot be
assigned to -- it is read only.
So I am wondering if there is any way to allow a service to interact
with desktop programmaticall y. Would appreciate any help. 4 15707
Julia,
The article that you referenced should be disregarded.
Services should never be set to interact with the desktop. You can not
always assume that there is an interactive user session to work with.
What you should do is have your service expose a remoting endpoint, and
then have an application that runs in the tray that makes calls to the
service through remoting to get/set information and receive feedback.
You can then have this program run on startup so that it is launched
when a user logs in.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
<ju*******@gmai l.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
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 with desktop"
checkbox on the service, and when I do it manually, the icon shows just
fine.
But I want the users to double-click the installation file and not have
to go to the Services and select the checkbox. So I used this example http://www.codeproject.com/csharp/Cs...iceDesktop.asp to check
the checkbox programmaticall y. I found out that it selected the
checkbox, but the icon still doesn't show. But if I go and manually
deselect and select the checkbox, it starts working. So I figured that
piece of code in the example does select the checkbox, but does not
really change the property of the service.
I also tried this:
ServiceControll er sc = new ServiceControll er("MyServiceNa me");
sc.ServiceType = ServiceType.Int eractiveProcess ;
but got an error message:
Property or indexer
'System.Service Process.Service Controller.Serv iceType' cannot be
assigned to -- it is read only.
So I am wondering if there is any way to allow a service to interact
with desktop programmaticall y. Would appreciate any help.
Hello ju*******@gmail .com,
The whole approach is wrong. You should avoid comunication with desktom from
the service.
Service and UI are 2 different things. Service started before user logon
and works in the different security context.
Moreover, in the Windows Vista you have no access to the "Allow service to
interact with desktop" at all.
You need to use some IPC approach to interact with your service from UI.
You can use Pipes, Sockets, Remoting, SOAP, DCOM - everything that suitable
in your case
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 with desktop"
checkbox on the service, and when I do it manually, the icon shows
just fine.
But I want the users to double-click the installation file and not
have to go to the Services and select the checkbox. So I used this
example http://www.codeproject.com/csharp/Cs...iceDesktop.asp
to check the checkbox programmaticall y. I found out that it selected
the checkbox, but the icon still doesn't show. But if I go and
manually deselect and select the checkbox, it starts working. So I
figured that piece of code in the example does select the checkbox,
but does not really change the property of the service.
I also tried this:
ServiceControll er sc = new ServiceControll er("MyServiceNa me");
sc.ServiceType = ServiceType.Int eractiveProcess ;
but got an error message:
Property or indexer
'System.Service Process.Service Controller.Serv iceType' cannot be
assigned to -- it is read only.
So I am wondering if there is any way to allow a service to interact
with desktop programmaticall y. Would appreciate any help.
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Thanks for quick reply, guys.
Ok, I guess my whole approach is wrong. It doesn't have to be a
service. What I need is some kind of program that starts when a user
logs in, it should run in the background and check the database once in
a while. When a certain data appears in the database, an icon on a
taskbar should change. So what is the easiest way to do it?
Hello ju*******@gmail .com,
Thanks for quick reply, guys.
Ok, I guess my whole approach is wrong. It doesn't have to be a
service. What I need is some kind of program that starts when a user
logs in, it should run in the background and check the database once
in a while. When a certain data appears in the database, an icon on a
taskbar should change. So what is the easiest way to do it?
Any app that will start from the Autorun folder
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 doesn't appear.
Is there a way to do this?
Thanks,
Rob
|
by: Kyzer |
last post by:
Hi all,
I am writing a DLL which includes a function that may open a dialog.
When this dialog is opened, an additional icon and program description
is displayed in the Windows taskbar (similar to any other program that
is opened). What I am looking to do is ensure that when the dialog is
opened, the title of the dialog doesn't display in the Windows taskbar
(eg. opening the Font box in Microsoft Word doesn't display another
item in the...
|
by: Mullin Yu |
last post by:
hi,
how can i add an an icon at the right button taskbar like that for MS-SQL
server that i can have two options
- Start
- Stop
which will call the OnStart of my Windows service and OnStop of my Windows
service respectively.
|
by: Brian |
last post by:
Dear my friends,
I have been helped by many C# gurus here, thank you very much.
My small application can help you fetch some good pictures from Internet.
You can get it from
http://members.rogers.com/5725brian/i_want_images/IWantImages1.0.zip. No
virus guarantee, nothing will harm your computer, trust me. Have fun to use
it.
But I still have some simple questions. When I run this program, it will
display a icon on taskbar. But this...
|
by: Mike |
last post by:
Greetings,
I have an application that is launched and controlled (hide or show)
via DDE messages from another application. The first time the
application is launched it shows as it should and the application icon
shows in the Windows taskbar. After a hide (this.hide on the form)
when it shows again (this.show on the form) there is no icon showing on
the Windows taskbar. If by chance a user clicks on a window there is
no way for...
| |
by: flaper87 |
last post by:
Hi everybody!!!!
I am developing an aplication, and i want it to stay on the system tray, i found out how to put the icon, but i can minimize it there, What do i have to do?, I'm using python(of course).
and this is the code:
# -*- coding: iso-8859-1 -*-
# Don't modify comment
import wx
|
by: Patrick Dugan |
last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots
up. Occasionally the icon that should appear in the system tray does not
show up. The program is still running in memory but the tray icon is not
there. If I start the program after Windows has booted up the icon shows
every time. I am assuming that the reason is due to the icon being created
before the system tray is loaded/running. I have used a timer with...
|
by: Robert McEuen |
last post by:
Access 97/2003 Windows XP (Classic Start Menu)
I just converted an mdb from A97 to A2K3 and found something that,
after Google search, doesn't appear to have been addressed in cdma...
I have a form "frmMainMenu" that is the designated startup form (under
Tools-Startup). In the Open event of that form, I open another form
"frmHidden" and set its Visible property to false.
When I converted to A2K3, it worked fine just like in A97. ...
|
by: Ali Rizwan |
last post by:
Hi all,
I was thinking my desktop application a bit easy but when i try to list the open window i got a trouble. I can list my own apps windows but cant list other windows.
For Example::
If i run Corel Draw or Ms Paint how can i detect the mspaint or Coreldraw task in my desktop application's taskbar as you have seen in simple xp explorer's taskbar that whenever you run any application a button appears in task bar. and have effects about...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |