win32 Timer範例
#include "stdafx.h"
#include <Windows.h>
void CALLBACK TimerProc(HWND hwnd, UINT message, UINT timerID, DWORD time) {
MessageBeep(-1);
printf("%s\n","a");
}
int _tmain(int argc, _TCHAR* argv[]){
MSG msg;
SetTimer(NULL, 0, 3000, TimerProc);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
KillTimer(NULL, 1);
return 0;
}
全站熱搜