MiniGUI API Reference (MiniGUI-Threads)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Macros | |
#define | SetTimer(hwnd, id, speed) SetTimerEx(hwnd, id, speed, NULL) |
The backward compatibility version of SetTimerEx. More... | |
#define | ResetTimer(hwnd, id, speed) ResetTimerEx(hwnd, id, speed, (TIMERPROC)INV_PTR) |
The backward compatibility version of ResetTimerEx. More... | |
Typedefs | |
typedef BOOL(* | TIMERPROC) (HWND, LINT, DWORD) |
Type of the timer callback procedure. More... | |
Functions | |
MG_EXPORT BOOL GUIAPI | SetTimerEx (HWND hWnd, LINT id, DWORD speed, TIMERPROC timer_proc) |
Creates a timer with the specified timeout value. More... | |
MG_EXPORT int GUIAPI | KillTimer (HWND hWnd, LINT id) |
Destroys a timer. More... | |
MG_EXPORT BOOL GUIAPI | ResetTimerEx (HWND hWnd, LINT id, DWORD speed, TIMERPROC timer_proc) |
Adjusts a timer with a different timeout value or different timer callback procedure. More... | |
MG_EXPORT BOOL GUIAPI | IsTimerInstalled (HWND hWnd, LINT id) |
Determine whether a timer is installed. More... | |
MG_EXPORT BOOL GUIAPI | HaveFreeTimer (void) |
Determine whether there is any free timer slot in the current thread. More... | |
#define ResetTimer | ( | hwnd, | |
id, | |||
speed | |||
) | ResetTimerEx(hwnd, id, speed, (TIMERPROC)INV_PTR) |
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.
BOOL (* TIMERPROC)(HWND, int, unsigned int)
BOOL GUIAPI HaveFreeTimer | ( | void | ) |
Determine whether there is any free timer slot in the current thread.
This function determines whether there is any free timer slot in the current thread.
Determine whether a timer is installed.
This function determines whether a timer with identifier id for a window hwnd has been installed in the current thread.
hWnd | The window owns the timer. |
id | The identifier of the timer. |
Destroys a timer.
This function destroys the specified timer id.
hWnd | The window owns the timer. |
id | The identifier of the timer. If id is 0, this function will kill all timers of created by the window. |
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 INV_PTR, the setting of timer callback procedure will not change. |
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 the 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.
Since 5.0.0, if the specified timer already exists when you call this function, MiniGUI will reset the timer by using the new parameters.
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. |
BOOL SetTimerEx (HWND hWnd, int id, unsigned int speed, \ TIMERPROC timer_proc);
Example: