SOL9 2.0 Class: ServiceControl

 SOL9 C++ Class Library  SOL9 Samples  SOL9 Tutorial  SOL9 FAQ  SOL9 ClassTree 

Source code

/*
 * ServiceControl.h 
 * Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9

#pragma once
// 2010/05/30

#include <sol/Object.h>
#include <winsvc.h>

namespace SOL {

class ServiceControl :public Object {

private:
    SC_HANDLE   hServiceControl;
    
public:
    ServiceControl(SC_HANDLE handle=NULL)
        :hServiceControl(handle)
    {
    }
    
public:
    ~ServiceControl()
    {
        if (hServiceControl) {
            CloseServiceHandle(hServiceControl);
            hServiceControl = NULL;
        }
    }

public:
    void setServiceControl(SC_HANDLE handle)
    {
        hServiceControl = handle;
    }

public:
    SC_HANDLE getServiceControl()
    {
        if (hServiceControl == NULL) {
            throw E_FAIL;
        } else {
            return hServiceControl;
        }
    }
};

}

Last modified: 1 Feb 2012

Copyright (c) 2009-2012 Antillia.com ALL RIGHTS RESERVED.