Lap-Trinh-Windows - Tran-Duy-Quang - 14-Timer - (Cuuduongthancong - Com)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Timer

Windows programming

CuuDuongThanCong.com https://fb.com/tailieudientucntt
Create timer
// Create timer with ID for every 10 seconds
SetTimer(hwnd, IDT_TIMER1, 10000, (TIMERPROC) NULL);

// Handle timer
case WM_TIMER:
switch (wParam)
{
case IDT_TIMER1:

break;
}
CuuDuongThanCong.com https://fb.com/tailieudientucntt
2
Another way - timerproc
VOID CALLBACK TimerProc(
_In_ HWND hwnd,
_In_ UINT uMsg, // The WM_TIMER message.
_In_ UINT_PTR idEvent, // The timer's identifier
_In_ DWORD dwTime // milliseconds that have
elapsed since the system was started
);

CuuDuongThanCong.com https://fb.com/tailieudientucntt
3
Stop timer
 KillTimer(hWnd, ID_TIMER)

CuuDuongThanCong.com https://fb.com/tailieudientucntt
4

You might also like