/*
* 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;
}
}
};
}
|