[Last Call] Learn how to a build a cloud-first strategyRegister Now


Windows Service with a Startup Winform

Posted on 2009-04-23
Medium Priority
Last Modified: 2012-05-06

I'm looking for a sample of creating a windows service, that has a WinForm.
The form allows the user to configur parameters for the Service.
For example - SQL Server connection parameters, and output directory.

The form should load when the service starts, and wait for the user input.
After the user has configured the parameters, and selects "Connect",
the form will save the configuration, then it will be unloaded
and the service continues running.

When the service is detecting a previous configuration,
it will wait for 30 seconds before using the previous configuration.

I know it's possible to use input arguments, but we prefer a GUI.

any help will be appreciated,
Thank you.
Question by:avitalk
1 Comment

Accepted Solution

kprestage earned 750 total points
ID: 24214760
Typically this is achieved by creating a separate EXE, In fact, this is exactly how SQL Server does it too.  If you look in your startup folder, you will notice there is a program call the "Service Manager".  This is the exe that you see running in your system tray to control SQL Server.  Because it is a separate exe, it has the added ability to connect to the SQL Server Service running on other computers as well.  

Services should never have a UI becuase they are meant to be run by the system.  A UI requires a person to be logged in interactively.  

C# provides a really easy to use "Service Controller" control in the toolbox that you just drop on your form that will provide start, stop and pause functionality out of the box.


Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question