1

I have developed a simple RPC server in executable format using Visual C++. Now I would like it to run as a service at Windows boot up. How to program this?

karikari
  • 6,359
  • 15
  • 61
  • 78

3 Answers3

2

This article may be useful:

Start Your Windows Programs From An NT Service

http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=719&av=49654

Scott Dillman
  • 856
  • 1
  • 9
  • 16
  • How to prevent the windows console from appearing? I need to make it invisible. – karikari Jun 21 '11 at 02:50
  • 1
    See if this answers your question: http://stackoverflow.com/questions/622592/win32-programming-hiding-console-window – Scott Dillman Jun 21 '11 at 14:31
  • Ok solved it:) How can I package it inside Visual Studio Installer? – karikari Jun 27 '11 at 06:23
  • @C.Trauma: The link is broken.. Can you help me too here (http://stackoverflow.com/questions/30596478/run-an-executable-as-service-in-c?noredirect=1#comment49284721_30596478) – Jackzz Jun 03 '15 at 04:28
1

Depending on the version of Windows you are using, you can use Sc to do it as shown at http://support.microsoft.com/kb/251192.

To fully integrate, there are many guides: one is at http://www.muukka.net/programming/service/

Femi
  • 63,688
  • 8
  • 117
  • 146
1

The simplest would be to create a windows service template from Visual Studio: http://msdn.microsoft.com/en-us/library/40xe80wx(v=vs.80).aspx

... then cut-and-paste.

Erwin Alva
  • 403
  • 4
  • 17
  • is this template is already RPC look alike? Means, does it works like a RPC too? – karikari Jun 15 '11 at 02:12
  • 1
    It's a generic windows service template. You already have the code for your RPC server, it should be simple enough to plug it in the generated source files. – Erwin Alva Jun 15 '11 at 23:44