Click here to Skip to main content
15,897,334 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends,
i wrote code for winform application in which i used timer to run form periodically but my timer runs on form or application level and i want to run this timer on system level.
i found that with the use of windows service i will achieve the same. so is that better way to go through this and if yes how to create and run application in windows service.
Posted
Comments
Richard MacCutchan 5-Apr-15 3:27am    
You cannot run a Window application as a service. Services have no UI component.

You cannot have the Windows service with UI. Here is the hint for you: if it was possible, how could this UI work without desktop? When you log off Windows, the service keeps working, but there is no a desktop.

If you need to work some UI on some schedule (also not a very good idea), you could have a service which starts your application at certain moments of times, and only when it is possible. But such service already exist, called Windows Task Scheduler: http://en.wikipedia.org/wiki/Windows_Task_Scheduler.

Please see my past answer: Problem a Window Services.

—SA
 
Share this answer
 
Comments
Member 11543226 6-Apr-15 2:15am    
But sir so how could i run form in background this form related to file import export kinda process for the device and i would have to run this application daily when system starts.
Sergey Alexandrovich Kryukov 6-Apr-15 2:25am    
First of all, make it clear to yourself: what is "running a form in background"?
—SA
Sergey Alexandrovich Kryukov 6-Apr-15 2:31am    
This is a bit different thing. Please see my Solution 2 then.
—SA
Member 11543226 wrote

But sir so how could i run form in background this form related to file import export kinda process for the device and i would have to run this application daily when system starts.
Running some application "when system starts" is not exactly the same thing: a service (with auto-start option) is just one of the ways corresponding only to one of the system boot and startup phases. There is a number of different ways corresponding to different phases.

Please see my past answers on this topic:
How to start the application before user login to the System,
Automatically start my c# application when i start my computer,
Start Up Application.

—SA
 
Share this answer
 
Comments
Member 11543226 6-Apr-15 3:25am    
I solved this by setting shortcut of my app to startup folder it is bit easy.
thanks for your help sir.
soonly come with new question.

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