zoukankan      html  css  js  c++  java
  • C++Builder 中如何修改服务描述,使用ChangeServiceConfig2(SERVICE_CONFIG_DESCRIPTION)

    http://blog.csdn.net/jpexe/article/details/4296955

    [cpp] view plain copy
     
    1. // ---------------------------------------------------------------------------  
    2. // 设置服务的描述  
    3. void TService1::SetDescription(WideString Desc)  
    4. {  
    5.     SC_HANDLE hSCM;  
    6.     SC_HANDLE hService;  
    7.     SERVICE_DESCRIPTION sd;  
    8.   
    9.     hSCM = OpenSCManager(  
    10.         NULL,  
    11.         NULL,  
    12.         SC_MANAGER_ALL_ACCESS);  
    13.     if (hSCM == 0)  
    14.     {  
    15.         return;  
    16.     }  
    17.     hService = OpenService(  
    18.         hSCM,  
    19.         this->DisplayName.c_str(),  
    20.         SERVICE_CHANGE_CONFIG);  
    21.     if (hService == 0)  
    22.     {  
    23.         return;  
    24.     }  
    25.   
    26.     sd.lpDescription = Desc.c_bstr();  
    27.   
    28.     ChangeServiceConfig2(  
    29.         hService,  
    30.         SERVICE_CONFIG_DESCRIPTION,  
    31.         & sd);  
    32.     CloseServiceHandle(hService);  
    33.     CloseServiceHandle(hSCM);  
    34. }  
    35.   
    36. //---------------------------------------------------------------------------  
    37.   
    38. void __fastcall TService1::ServiceAfterInstall(TService *Sender)  
    39. {  
    40.     // 安装结束以后, 设置服务的描述  
    41.     this->SetDescription  
    42.         (L" 我的描述 描述 喵");  
    43. }  
    44. //---------------------------------------------------------------------------  

    http://blog.csdn.net/warrially/article/details/8513985

  • 相关阅读:
    ajax 同步模式与异步模式
    Ajax -get 请求
    Ajax -post 请求
    Ajax 遵循HTTP协议
    Ajax 发送请求
    宽高自适应案例
    伸缩导航案例
    伸缩属性的 grow与 shrink
    伸缩布局
    hdu-5858 Hard problem(数学)
  • 原文地址:https://www.cnblogs.com/findumars/p/6359750.html
Copyright © 2011-2022 走看看