I have a Windows Forms application that I wrote that does some monitoring of an inbox and database. The customer has informed me that it needs to run every time the server reboots. Shame on me for letting the customer change the requirements.
I was thinking … is there any way to make a Windows Forms application run as a service so that it starts automatically?
Clarification
I would like to try to not have to write any more code … if possible!
(This answer is obsolete, since the linked article was deleted in 2012. However, StackOverflow does not allow the accepted answer to be deleted. So, kindly do not downvote this answer, since I have informed you that it is obsolete.)
Alt link: https://web.archive.org/web/20111221041348/http://www.codeproject.com/kb/system/xyntservice.aspx
C++ source (Or use the Browse Code tab on the article): https://web.archive.org/web/20111228050501/http://www.codeproject.com/KB/system/xyntservice.aspx
Start Your Windows Programs From An NT Service
Check this article out: http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=719&av=49654
It’s a really old article, but it has worked for 8 years and it continues to be kept up to date by the author.
It will do what you want to do.