在C ++中设置Windows服务描述 [英] Set Windows Service Description in C++

查看:526
本文介绍了在C ++中设置Windows服务描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 CreateService 安装Windows Service可执行文件,但我似乎无法找到如何设置服务的描述。

I am using CreateService to installs a Windows Service executable however I can't seem to find out how to set the description for the service.

有谁知道如何做?

谢谢。

推荐答案

致电 ChangeServiceConfig2 dwInfoLevel 参数传递 SERVICE_CONFIG_DESCRIPTION 。您还需要一个服务的句柄,但 CreateService 会提供其中一个。

Call ChangeServiceConfig2 passing SERVICE_CONFIG_DESCRIPTION as the dwInfoLevel parameter. You will also need a handle to the service, but CreateService gives you one of those.

SERVICE_DESCRIPTION description = { L"The service description" };
ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &description);

这篇关于在C ++中设置Windows服务描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆