Windows programming timer

xiaoxiao2021-03-06  44

Timer use: Three methods:

One,

SetTimer (hwnd, 1, uimsecinterval, null); the third parameter is time interval in milliseconds. By calling KillTimer (HWND, 1); WM_TIMER message. The second parameter is the same timer ID number as SetTimer. When a WM_TIMER message is received, the value of WPARAM is the timer ID number, and the value of lparam is 0. / * ---------------- Tip: You can use #define to define different timer ID values. #define time_sec 1 # define time_min 2 then call SetTimer Settings Two Timer SetTimer (HWND, TIMER_SEC, 1000, NULL);

Settimer (hwnd, timer_min, 60000, null); ----------------------------------- * / Second, Windows sends a timer message to another function. Void Callback TimerProc (HWND HWND, UINT MESSAGE, UINT ITIMERID, DWORD DWTIME)

{

Handling WM_TIMER message

} Settimer (HWND, ITIMERID, IMSECINTERVALVAL, TIMERPROC); Third, similar to the second method. Itimerid = setTimer (NULL, 0, WMSECINTERVAL, TIMERPROC); if there is no timer available, then the value of the back ITIMERID will be NULL. The corresponding KillTimer function is: KillTimer (NULL, ITIMERID); time display on the simulation 7 segment display.

转载请注明原文地址:https://www.9cbs.com/read-52246.html

New Post(0)