- void TService1::SetDescription(WideString Desc)
- {
- SC_HANDLE hSCM;
- SC_HANDLE hService;
- SERVICE_DESCRIPTION sd;
-
- hSCM = OpenSCManager(
- NULL,
- NULL,
- SC_MANAGER_ALL_ACCESS);
- if (hSCM == 0)
- {
- return;
- }
- hService = OpenService(
- hSCM,
- this->DisplayName.c_str(),
- SERVICE_CHANGE_CONFIG);
- if (hService == 0)
- {
- return;
- }
-
- sd.lpDescription = Desc.c_bstr();
-
- ChangeServiceConfig2(
- hService,
- SERVICE_CONFIG_DESCRIPTION,
- & sd);
- CloseServiceHandle(hService);
- CloseServiceHandle(hSCM);
- }
-
-
- void __fastcall TService1::ServiceAfterInstall(TService *Sender)
- {
-
- this->SetDescription
- (L" 我的描述 描述 喵");
- }
http://blog.csdn.net/warrially/article/details/8513985