tdcservice.h
上传用户:wsk323
上传日期:2007-01-05
资源大小:403k
文件大小:2k
- // tdcservice.h
- //
- // Definitions for TDCService
- //
- #ifndef _TDCService_H_
- #define _TDCService_H_
- //---------------------------------------------------------------------------
- #include <vclvcl.h>
- #pragma hdrstop
- #include "tdcservmsg.h" // Event message ids
- #define SERVICE_CONTROL_USER 128
- class TDCService
- {
- public:
- TDCService(const char* szServiceName);
- virtual ~TDCService();
- BOOL ParseStandardArgs(int argc, char* argv[]);
- BOOL IsInstalled();
- BOOL Install();
- BOOL Uninstall();
- void LogEvent(WORD wType, DWORD dwID,
- const char* pszS1 = NULL,
- const char* pszS2 = NULL,
- const char* pszS3 = NULL);
- BOOL StartService();
- void SetStatus(DWORD dwState);
- BOOL Initialize();
- virtual void Run();
- virtual BOOL OnInit();
- virtual void OnStop();
- virtual void OnInterrogate();
- virtual void OnPause();
- virtual void OnContinue();
- virtual void OnShutdown();
- virtual BOOL OnUserControl(DWORD dwOpcode);
- void DebugMsg(const char* pszFormat, ...);
-
- // static member functions
- static void WINAPI ServiceMain(DWORD dwArgc, LPTSTR* lpszArgv);
- static void WINAPI Handler(DWORD dwOpcode);
- // data members
- char m_szServiceName[64];
- int m_iMajorVersion;
- int m_iMinorVersion;
- SERVICE_STATUS_HANDLE m_hServiceStatus;
- SERVICE_STATUS m_Status;
- BOOL m_bIsRunning;
- // static data
- static TDCService* m_pThis; // nasty hack to get object ptr
- private:
- HANDLE m_hEventSource;
- };
- #endif // _NTSERVICE_H_