win32service.hpp

来自「"More for C++" is a class library that p」· HPP 代码 · 共 97 行

HPP
97
字号
////  This file is part of the "More for C++" library////  Copyright (c) 1999-2003 by Thorsten Goertz (thorsten@goertz.com)////  The "More for C++" library is free software; you can redistribute it and/or//  modify it under the terms of the license that comes with this package.////  Read "license.txt" for more details.////  THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED//  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES//  OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.////////////////////////////////////////////////////////////////////////////////#ifndef MORE_OS_WIN32_WIN32SERVICE_HPP#define MORE_OS_WIN32_WIN32SERVICE_HPP#include <more/array.hpp>#include <more/exception.hpp>#include <more/pointer.hpp>#include <more/string.hpp>////////////////////////////////////////////////////////////////////////////////namespace more{  namespace os  {    namespace win32    {      class Win32Service      {        public:          class NotSupported: public more::Exception          {          };          class AlreadyExists: public more::Exception          {          };          class Unknown: public more::Exception          {          };          class Servant          {            public:              virtual void run( ) = 0;              virtual void onStop( ) = 0;            protected:              virtual ~Servant( );          };          enum State          {            WIN32_SERVICE_STATE_UNKNOWN,            WIN32_SERVICE_STOPPED,            WIN32_SERVICE_START_PENDING,            WIN32_SERVICE_STOP_PENDING,            WIN32_SERVICE_RUNNING,            WIN32_SERVICE_CONTINUE_PENDING,            WIN32_SERVICE_PAUSE_PENDING,            WIN32_SERVICE_PAUSED          };          static p<Win32Service> create( const String& sName ) throw( NotSupported );          virtual bool exists( ) const = 0;          virtual String getName( ) const = 0;          virtual void execute( const p<Servant>& ) throw( Unknown ) = 0;          virtual bool install( const Array<String>& argV,                                const String& sUser = "",                                const String& sPwd = "" ) = 0;          virtual bool uninstall( ) throw( Unknown ) = 0;          virtual void start( ) throw( Unknown ) = 0;          virtual void stop( ) throw( Unknown ) = 0;          virtual State getState( ) throw( Unknown ) = 0;        protected:          virtual ~Win32Service( );      };    }  }}////////////////////////////////////////////////////////////////////////////////#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?