简体   繁体   English

在C / C ++中创建Windows服务的任何示例? (没有GUI)

[英]Any examples of creating a windows service in C/C++ ? (No GUI)

This is a great reference of how it all works at a relatively low level: 这是一个很好的参考,它在一个相对较低的水平如何工作:
http://msdn.microsoft.com/en-us/library/ms685967%28VS.85%29.aspx http://msdn.microsoft.com/en-us/library/ms685967%28VS.85%29.aspx

However, is there a working C/C++ example that shows how to install and run code as a service - all done in code, not using any of the windows gui? 但是,是否有一个工作的C / C ++示例显示如何安装和运行代码作为服务 - 所有这些都是在代码中完成的,而不是使用任何windows gui?

You might want to have a look at the source . 您可能想查看源代码 of the Apache Commons Daemon procrun utility. Apache Commons Daemon procrun实用程序。 It is a little daunting because of all the things it handles, but then usually the lesson is that you just want to use it instead of reimplementing it anyway :) 它有点令人生畏,因为它处理的所有东西,但通常教训是你只是想使用它而不是重新实现它无论如何:)

我建议从Visual Studio 服务模板项目开始

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM