在C++中设置Windows服务描述
Set Windows Service Description in C++
我正在使用CreateService
安装Windows服务可执行文件,但我似乎找不到如何设置服务的描述。
有人知道怎么做吗?
谢谢。
调用ChangeServiceConfig2
,传递SERVICE_CONFIG_DESCRIPTION
作为dwInfoLevel
参数。您还需要一个服务句柄,但CreateService
会为您提供其中一个句柄。
SERVICE_DESCRIPTION description = { L"The service description" };
ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &description);
请查看此MSDN页面以获取示例。使用ChangeServiceConfig2
方法。
SERVICE_DESCRIPTION sd;
SC_HANDLE schService;
SC_HANDLE schSCManager;
// Not shown: Get a handle to the SCM database.
// Not shown: Get a handle to the service.
sd.lpDescription = TEXT("Description");
ChangeServiceConfig2( schService, // handle to service
SERVICE_CONFIG_DESCRIPTION, // change: description
&sd) ) // new description
相关文章:
- 使用VerQueryValue检索应用程序的文件描述
- 如何使用重载的相等(==)运算符向测试用例添加描述
- 如何在C/C++中用FD_set Unix设置套接字文件描述符
- Active Directory:从网络服务帐户下运行的Windows服务调用ADsOpenObject时失败
- 检测win32服务创建和删除的最佳方法
- PC中的程序和PHONE中的本机描述应用程序之间的数据连接
- 使用 mod_gsoap 部署服务时,如何在 Gsoap 中更改 soap 上下文的模式?
- 从 Boost ASIO 获取 epoll 描述符 io_service对象
- 当服务中的事件被触发时,如何将响应从服务发送回客户端?
- gRPC 生成的代码缺少服务实现
- C# DLL 从C++应用程序调用 SOAP Web 服务
- 在 Winrt/C++ 中使用应用服务
- 将第二个 GATT 服务添加到 Movesense 容器
- 从运行服务的应用程序代码中提取窗口句柄
- I2C 文件描述符上的 I2C 总线可写/可读标志
- 如何在 CompleteAsyncIO 中访问 IOMemoryBufferDescriptor,该描述符通过中断 EP
- 对于使用高级服务的分钟数和应付金额,我不断得到相同的数字
- 在C++中设置Windows服务描述
- 向多个自定义c++ BLE GATT服务添加特征用户描述
- 向自定义c++ BLE GATT服务添加特征用户描述