📄 warwin32shutdownkey.h
字号:
/** */#ifndef WAR_WIN32_SHUTDOWN_KEY_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_WIN32_REGISTRY_H# include "WarWin32Registry.h"#endif#ifndef WAR_SHUTDOWN_ENGINE_H# include "WarShutdownEngine.h"#endif#ifndef WAR_TIMER_EVENT_H# include "WarTimerEvent.h"#endif#ifndef WAR_LOG_H# include "WarLog.h"#endif#ifndef WAR_TIME_H# include "WarTime.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarWin32ShutdownKey : public WarTimerEvent{public: // LIFECYCLE /** * Default constructor. */ WarWin32ShutdownKey(int msRepeatDelay) : WarTimerEvent( WarTime(WarTime::WarGetCurrentTime() + 10000), TIMER_LOOP_RELATIVE, 2500, false), mHaveStartedShutdown(false) { mRegKey.Open(HKEY_LOCAL_MACHINE, WarWin32Registry::mRootPath); mRegKey.SetValue(WAR_WINNT_SHUTDOWN, 0); } // OPERATORS // OPERATIONS // CALLBACK // ACCESS // INQUIRY protected: virtual void OnTimer() { if (mHaveStartedShutdown) return; WarLog thrd_log(WARLOG_THREADS, "WarWin32ShutdownKey::OnTimer()"); if (thrd_log) { thrd_log << "Verifying registry key" << WAR_WINNT_SHUTDOWN << war_endl; } if (mRegKey.GetIntValue(WAR_WINNT_SHUTDOWN)) { WarLog sys_log(WARLOG_SYSTEM, "WarWin32ShutdownKey::OnTimer()"); sys_log << "Initiating shutdown. The registry key \"" << WAR_WINNT_SHUTDOWN << "\" is non-zero." << war_endl; WarShutdownEngine::GetEngine().StartShutdown(); mHaveStartedShutdown = true; } }private: bool mHaveStartedShutdown; WarWin32Registry mRegKey;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif /* WarWin32ShutdownKey_h_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -