我做了一个后台运行的程序,我想加入到系统的服务里面。
如何做,函数是什么啊,我查不到资料,急。

解决方案 »

  1.   

    http://www.codeguru.com/Cpp/W-P/system/ntservices/article.php/c5701/
      

  2.   

    SC_HANDLE CreateService(
      SC_HANDLE hSCManager,
      LPCTSTR lpServiceName,
      LPCTSTR lpDisplayName,
      DWORD dwDesiredAccess,
      DWORD dwServiceType,
      DWORD dwStartType,
      DWORD dwErrorControl,
      LPCTSTR lpBinaryPathName,
      LPCTSTR lpLoadOrderGroup,
      LPDWORD lpdwTagId,
      LPCTSTR lpDependencies,
      LPCTSTR lpServiceStartName,
      LPCTSTR lpPassword
    );
    Parameters
    hSCManager 
    [in] Handle to the service control manager database. This handle is returned by the OpenSCManager function and must have the SC_MANAGER_CREATE_SERVICE access right. For more information, see Service Security and Access Rights. 
    lpServiceName 
    [in] Pointer to a null-terminated string that specifies the name of the service to install. The maximum string length is 256 characters. The service control manager database preserves the case of the characters, but service name comparisons are always case insensitive. Forward-slash (/) and back-slash (\) are invalid service name characters. 
    lpDisplayName 
    [in] Pointer to a null-terminated string that contains the display name to be used by user interface programs to identify the service. This string has a maximum length of 256 characters. The name is case-preserved in the service control manager. Display name comparisons are always case-insensitive. 
    dwDesiredAccess 
    [in] Access to the service. Before granting the requested access, the system checks the access token of the calling process. For a list of values, see Service Security and Access Rights. 
    dwServiceType 
    [in] Service types. This parameter can be one of the following values.