代码拉取完成,页面将自动刷新
同步操作将从 itas109/KeyCastOW 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
Based on "Simple C++ Timer Wrapper"
http://www.codeproject.com/Articles/146617/Simple-C-Timer-Wrapper
by ken.loveday
v1.0 2013 ArmyOfPirates
*/
static void CALLBACK TimerProc(void*, BOOLEAN);
static void CALLBACK TimerProcOnce(void* param, BOOLEAN timerCalled);
///////////////////////////////////////////////////////////////////////////////
//
// class CTimer
//
class CTimer
{
public:
CTimer()
{
m_hTimer = NULL;
m_mutexCount = 0;
}
virtual ~CTimer()
{
Stop();
}
bool Start(unsigned int interval, // interval in ms
bool immediately = false,// true to call first event immediately
bool once = false) // true to call timed event only once
{
if( m_hTimer )
{
Stop();
}
SetCount(0);
BOOL success = CreateTimerQueueTimer( &m_hTimer,
NULL,
once ? TimerProcOnce : TimerProc,
this,
immediately ? 0 : interval,
once ? 0 : interval,
WT_EXECUTEINTIMERTHREAD);
return( success != 0 );
}
void Stop()
{
DeleteTimerQueueTimer( NULL, m_hTimer, NULL );
m_hTimer = NULL ;
}
void (*OnTimedEvent)();
void SetCount(int value)
{
InterlockedExchange( &m_mutexCount, value );
}
int GetCount()
{
return InterlockedExchangeAdd( &m_mutexCount, 0 );
}
bool Enabled()
{
return m_hTimer != NULL;
}
private:
HANDLE m_hTimer;
long m_mutexCount;
};
///////////////////////////////////////////////////////////////////////////////
//
// TimerProc
//
static void CALLBACK TimerProc(void* param, BOOLEAN timerCalled)
{
CTimer* timer = static_cast<CTimer*>(param);
timer->SetCount( timer->GetCount()+1 );
timer->OnTimedEvent();
};
static void CALLBACK TimerProcOnce(void* param, BOOLEAN timerCalled)
{
CTimer* timer = static_cast<CTimer*>(param);
timer->SetCount( timer->GetCount()+1 );
timer->OnTimedEvent();
if( timer->Enabled() )
timer->Stop();
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。