⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 win32serviceimpl.hpp

📁 "More for C++" is a class library that provides some features that are usually common for object ori
💻 HPP
字号:
////  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 WIN32SERVICEIMPL_HPP#define WIN32SERVICEIMPL_HPP////////////////////////////////////////////////////////////////////////////////// "windows.h" must have been included!#include <more/core/finalizable.hpp>#include <more/os/win32/win32service.hpp>#include <more/util/singleton.hpp>////////////////////////////////////////////////////////////////////////////////namespace more{  namespace os  {    namespace win32    {      class Win32ServiceImpl:      public more::os::win32::Win32Service      {        public:          Win32ServiceImpl( const String& sName ) throw( Win32Service::NotSupported );          virtual bool exists( ) const;          virtual String getName( ) const;          virtual void execute( const p<Win32Service::Servant>& ) throw( Win32Service::Unknown );          virtual bool install( const Array<String>& sArgV,                                const String& sUser,                                const String& sPwd );          virtual bool uninstall( ) throw( Win32Service::Unknown );          virtual void start( ) throw( Win32Service::Unknown );          virtual void stop( ) throw( Win32Service::Unknown );          virtual Win32Service::State getState( ) throw( Win32Service::Unknown );        private:          class UnknownImpl: public Win32Service::Unknown          {            public:              UnknownImpl( const String& sName );              virtual operator const char* ( ) const;            private:              String m_sDescription;          };          class AlreadyExistsImpl: public Win32Service::AlreadyExists          {            public:              AlreadyExistsImpl( const String& sName );              virtual operator const char* ( ) const;            private:              String m_sDescription;          };          class ServiceManagerGuard          {            public:              ServiceManagerGuard( ) throw( Win32Service::NotSupported );             ~ServiceManagerGuard( );             operator SC_HANDLE ( ) const;            private:              SC_HANDLE m_hServiceManager;          };          class ServiceCtrlHandler: public more::util::Singleton<ServiceCtrlHandler>          {            public:              ServiceCtrlHandler( const String& sName,                                  const p<Win32Service::Servant>& ) throw( Win32Service::Unknown );            private:              static void WINAPI serviceMain( DWORD nArgC, LPTSTR* pcArgS );              static void WINAPI serviceCtrlHandler( DWORD nControlCode );              void updateStatus( DWORD newState, DWORD milliSecondsToWait = 0 );              String                    m_sName;              p<Win32Service::Servant>  m_pServant;              DWORD                     m_nCheckPoint;              SERVICE_STATUS_HANDLE     m_hStatus;              SERVICE_STATUS            m_status;          };          String m_sName;      };    }  }}////////////////////////////////////////////////////////////////////////////////#endif

⌨️ 快捷键说明

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