Question for advanced .net developers
Hello,
There is no one who seems to have the answer to my question. I have searched the whole internet for this nut to crack....
I have a service which starts automaticly at windows startup. At the "On start" event of the service the icon should be created at the same time with the "user interactive with desktop" option but (offcourse) before a user has logged in, this option has no effect...the result is an icon which won't get created as soon as an user has logged in... My question is:
Is there a class in .net which notifies the windows login event?
(ps: i already tried to use the system.environment.username-class.. That doesn't work due to the fact that the service is started BEFORE login so the username = System and won't change if a user logs in...)
Re: Question for advanced .net developers
Why use C:\Documents and Settings\All Users\Desktop, check for your icon, if it doesn't exist create it. Whenever anybody logs into your server, the icon will already be available.
Re: Question for advanced .net developers
It's not about the desktop-icon...it's about the systemtray-icon
Re: Question for advanced .net developers
Maybe you could set a timer to check for the winlogin.exe process, once the process is found, add the icon, and disable the timer.
Re: Question for advanced .net developers
I don't think you can do this.. the services are started after you log on... take a look at your lower right screen.. when I log in.. there isnt anything listed in there at first, then each icon appears one after another.. its pretty quick, but yet its still after you log on.. I think Windows does this on purpose, as a security measure or something. Ensures the correct services are started depending on the logged in user.... (but I could be wrong...)
***EDIT - However, I did notice different logon types... Try changing your service to log on as Local Service instead as Local System (log on options in service)
Re: Question for advanced .net developers
Why not write a tertiary program and put it under startup?
This way, when it's executed, it will attach to the service (marshalling?)
Just like how the SQL Service Manager works.
Re: Question for advanced .net developers
I agree with Harddisk, use another application. Services are not intended to have any GUI at all even with the interact with desktop flag on. I don't believe Services wait for you to login at all.
Re: Question for advanced .net developers
I had a need for similar functionality. I wrote my Windows Service with the Enterprise Library so that I could use the Configuration Application Block (among others) so that any parts I wanted to change I had easy access to.
I wrote Another Win Forms application that looks at the Status of the Windows Service and Updates a Tray Icon based on it's current Status. I also have A "Configure" window that loads the settings from the config files and allows a user to update them on the fly.
It is really ALOT easier than I thought it would be.