Windows Service with Forms

grip003

Regular
Joined
Sep 2, 2004
Messages
89
Location
North Carolina
Is there any way to create a windows service and have that service load up a form and then minimize it to the system tray? I have a backup utility application that I wrote to backup a server, and one day the server went down while I was on vacation. I had them boot it back up, but the backup utility would not start unless a user logged into the server, which I did not allow while I was away. I would really like that backup utility to run as a service so I could avoid this problem the next time the server needs to be re-booted.

So far, I have tried to create a service that loads my main form in the OnStart() function. The service starts, but no form is loaded. Any ideas?
 
This may be a silly question, but did you try putting a link to your backup utility program in the Start folder? Or making a registry entry in one of the Run folders?

Edit:

NM I thought about it and answered my own question. Start and run work when you log in. Never tried making a service so unfortunately I won't be much of a help.
 
Services run under their own desktop - any forms they display will be displayed on this desktop and not visible to any other logged in user.

You would need to create a separate application that runs under the user's profile and communicates with the service.
 
If I were to have a completely separate application that does all the work, could I use the service to start that application? If I did this, would the application just run in that 'other' desktop?
 
The service would be set to auto-start and would therefore be automatically started when the server was rebooted.

The UI would be a separate application that would be launched either on demand by a user or as part of their start-up group (or similar).
 
I'm sorry, I still think I don't understand. The real question I think I have is can the GUI application BE the service? I use the GUI to display progress bars and I use it to set up backup scheduling. The software can also auto-burn backups as well, so the scheduling for that is also done through the GUI. Maybe this application is just not service material?
 
No - a service cannot display any UI stuff as it has it's own desktop and this is where the UI would appear rather than the desktop of a logged on user (if there even is a logged on user).
 
Back
Top