Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi,


I have Created Windows_Form_Application, I need to run this app in background whenever windows starts... (Don't say, Put your Application in Start up). By adding Windows Service application Can it be possible to run Form application in background?



Thanks in advance..
Posted
Comments
ZurdoDev 29-Oct-15 8:04am    
The correct answer is to put it in start up. Why don't you like that?
Philippe Mori 29-Oct-15 12:23pm    
It is well known that services does not have an UI.

A Windows service has no application message pump, thus it is unable to display whatever graphical UI.
So a service does not seem to be the solution here.

You have several choices:
- you keep your UI but won't be able to run it as service.
- you throw the UI away, only keeping the functional part (what the service will have to accomplish).
- you keep your actual application and develop a second project that will be the program that is run as a service.
 
Share this answer
 
You cannot run an interactive application (Windows Forms) as a service as it will just sit there waiting for user input that will never happen. Why? Because applications running as a service are running under a desktop separate that the user cannot see.

You also cannot launch an interactive application from a service application as the application will launch on the service desktop, not the users.

To launch at Windows startup (before anyone logs into the console), you MUST rewrite the application as a service app, not Windows Forms. There cannot be any user interface at all.

If you need to have user interaction with the service, write a separate Windows Forms application that the user can launch that communicates with the service through some of Inter-Process Communication method, such as named pipes.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900