#define ResetTimer | ( | hwnd, | |||
id, | |||||
speed | ) | ResetTimerEx(hwnd, id, speed, (TIMERPROC)0xFFFFFFFF) |
The backward compatibility version of ResetTimerEx.
#define SetTimer | ( | hwnd, | |||
id, | |||||
speed | ) | SetTimerEx(hwnd, id, speed, NULL) |
The backward compatibility version of SetTimerEx.
Type of the timer callback procedure.
This is the prototype of the callback procedure of a timer created by SetTimerEx. MiniGUI will call the timer procedure instead of sending MSG_TIMER message.
If the return value of a timer procedure is FALSE, the timer will be killed by MiniGUI automatically. This can be used to implement a one-shot timer.
unsigned int GUIAPI GetTickCount | ( | void | ) |
Retrieves the tick counts that have elapsed since MiniGUI was started.
This function retrieves the tick counts that have elapsed since MiniGUI was started. It is limited to the resolution of the system timer, i.e. for a general Linux box, the returned tick count value is in unit of 10ms.
BOOL GUIAPI HaveFreeTimer | ( | void | ) |
Determines whether there is any free timer slot in the system.
This function determines whether there is any free timer slot in the system.
Determines whether a timer is installed.
This function determines whether a timer with identifier id of a window hwnd has been installed.
hWnd | The window owns the timer. | |
id | The identifier of the timer. |
int GUIAPI KillTimer | ( | HWND | hWnd, | |
int | id | |||
) |
Destroys a timer.
This function destroys the specified timer id.
hWnd | The window owns the timer. | |
id | The identifier of the timer. If id equals or is less than 0, this function will kill all timers in the system. |
Adjusts a timer with a different timeout value or different timer callback procedure.
This function resets a timer with the specified timeout speed value.
hWnd | The window owns the timer. | |
id | The identifier of the timer. | |
speed | The new timeout value. | |
timer_proc | The new timer callback procedure. If timer_proc is 0xFFFFFFFF, the setting of timer callback procedure will not changed. |
Creates a timer with the specified timeout value.
This function creates a timer with the specified timeout value speed. Note that the timeout value is in unit of 10 ms. When the timer expires, an MSG_TIMER message will be send to the window hWnd if timer_proc is NULL, otherwise MiniGUI will call timer_proc by passing hWnd, id, and the tick count when this timer had expired to this callback procedure.
hWnd | The window receives the MSG_TIMER message. If timer_proc is not NULL, MiniGUI will call timer_proc instead sending MSG_TIMER message to this window. If you use timer callback procedure, hWnd can be any value you can pass. | |
id | The identifier of the timer, will be passed to the window with MSG_TIMER message as the first parameter of the message. | |
speed | The timeout value of the timer. Note that the timeout value is in unit of 10 ms. | |
timer_proc | The timer callback procedure. If this argument is NULL, MiniGUI will send MSG_TIMER to the window procedure of hWnd. |
Example:
/* * A typical handling of timer. */ int FlyingGUIWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: /* create a timer which expires every 100 ms, and whose id is 100. */ #ifdef _MGTIMER_UNIT_10MS SetTimer (hWnd, 100, 10); #else SetTimer (hWnd, 100, 100); #endif break; /* handling the MSG_TIMER message. */ case MSG_TIMER: if (wParam == 100) /* if it is the timer whose id is 100. */ InvalidateRect (hWnd, NULL, FALSE); break; case MSG_CLOSE: /* kill the timer whose id is 100. */ KillTimer (hWnd, 100); DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam); }