/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Multimedia Timer * * Timer Interrupttion per interval[ms] */ #include<windows.h> #include<mmsystem.h> #pragma comment(lib, "winmm.lib") void CALLBACK TimeProc(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { /** * Timer Interruption */ } void main() { UINT uDelay = 1000; UINT uResolution = 1; DWORD dwUser = NULL; UINT fuEvent = TIME_PERIODIC; //You also choose TIME_ONESHOT; MMRESULT FTimerID; timeBeginPeriod(1); FTimerID = timeSetEvent(uDelay, uResolution, TimeProc, dwUser, fuEvent); if(FTimerID==NULL){ printf("Failed to generate multimedia timer.\n"); } Sleep(10000); timeKillEvent(FTimerID); timeEndPeriod(1); }