SetTimer!
Пример:
#include <windows.h>
#include <stdio.h>
void CALLBACK scheduled_task_1 (HWND hwnd, UINT msg, UINT id, DWORD time)
{
puts("Executing scheduled_task_1 every half-second event");
}
void CALLBACK scheduled_task_2 (HWND hwnd, UINT msg, UINT id, DWORD time)
{
puts("Executing scheduled_task_2 every two seconds event");
}
void CALLBACK scheduled_task_3 (HWND hwnd, UINT msg, UINT id, DWORD time)
{
puts("Executing scheduled_task_3 24 hours event");
}
void messageLoop(void) {
MSG msg;
while (GetMessage(&msg, NULL, 0, 0) > 0)
DispatchMessage( &msg );
}
int main(void)
{
while(true)
{
SetTimer (NULL, 0, 500, scheduled_task_1); /* every half-second */
SetTimer (NULL, 0, 2000, scheduled_task_2); /* every two seconds */
SetTimer (NULL, 0, 60*60*24*1000, scheduled_task_3); /* after 24 hours or 86400000 milliseconds */
messageLoop();
}
return 0;
}