| Back to logs list
342006 2008 年 11 月 13 日 09:04 Reading (loading. ..) Comments (0) Category: Personal Diary
;
Method One:
SetTimer (NULL,
Discount Vibram Five Fingers, 0, 1000, (TIMERPROC) Timer2Proc);
VOID CALLBACK Timer2Proc (
HWND hWnd, / / handle of window for timer messages
UINT uMsg,
Vibram Shoes Sale, / / WM_TIMER message
UINT idEvent,
Vibram Five Fingers Classic, / / timer identifier
DWORD dwTime / / current system time
)
{
return;
}
Method Two:
/ / DLL function in a thread like this using the Timer
UINT ThreadProc (LPVOID)
{
SetTimer (NULL, 1, 5000, NULL);
MSG msg;
/ / PeekMessage force the system to create a message for the thread stack
PeekMessage (& msg,
Vibram Five Fingers, NULL, NULL, NULL, FALSE);
while (GetMessage (& msg,
Vibram Five Fingers Kso, NULL, NULL ,
Vibram Five Fingers Sale, NULL))
{
switch (msg.message)
{
case WM_TIMER:
{
/ / here once every 5 seconds
}
break;
}
/ / TranslateMessage (& msg);
/ / DispatchMessage (& msg);
}
KillTimer (NULL, 1);
return 0;
}
Method three:
creates a thread that repeatedly read the system time is not on it? if the strict timing requirements, with the Sleep on it
UINT TimerThread (LPVOID pama)
{
UINT oldTickCount, newTickCount;
oldTickCount = GetTickCount ();
while (TRUE)
{
while (TRUE)
{
newTickCount = GetTickCount () ;
if (newTickCount - oldTickCount> = 100)
{
oldTickCount = newTickCount;
break;
}
}
TimeProc ();
}
return 0;
}
called once about every 100ms TimeProc ();