本帖最后由 VisualEleven 于 2012-07-10 07:24:58 编辑

解决方案 »

  1.   

    OpenService
    The OpenService function opens an existing service. SC_HANDLE OpenService(
      SC_HANDLE hSCManager,  // handle to SCM database
      LPCTSTR lpServiceName, // service name
      DWORD dwDesiredAccess  // access
    );QueryServiceStatus
    The QueryServiceStatus function retrieves the current status of the specified service. This function has been superseded by the QueryServiceStatusEx function. QueryServiceStatusEx returns the same information QueryServiceStatus returns, with the addition of the process identifier and additional flags for the service.BOOL QueryServiceStatus(
      SC_HANDLE hService,               // handle to service
      LPSERVICE_STATUS lpServiceStatus  // service status
    );
      

  2.   

    DOS下也可以直接看到:
    sc query DHCP Client
    看到:
    SERVICE_NAME: DHCP
            TYPE               : 20  WIN32_SHARE_PROCESS
            STATE              : 4  RUNNING
                                    (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
            WIN32_EXIT_CODE    : 0  (0x0)
            SERVICE_EXIT_CODE  : 0  (0x0)
            CHECKPOINT         : 0x0
            WAIT_HINT          : 0x0
      

  3.   

    http://blog.csdn.net/fjssharpsword/article/details/6093759