Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Timer operations
[Windowing functions]

Functions


Function Documentation

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.

Returns:
The tick counts value that have elapsed since MiniGUI was started.

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.

Returns:
TRUE for yes, otherwise FALSE.
See also:
IsTimerInstalled

BOOL GUIAPI IsTimerInstalled HWND  hWnd,
int  id
 

Determines whether a timer is installed.

This function determines whether a timer with identifier id of a window hwnd has been installed.

Parameters:
hWnd The window owns the timer.
id The identifier of the timer.
Returns:
TRUE for installed, otherwise FALSE.
See also:
SetTimer, HaveFreeTimer

BOOL GUIAPI KillTimer HWND  hWnd,
int  id
 

Destroys a timer.

This function destroys the specified timer id.

Parameters:
hWnd The window owns the timer.
id The identifier of the timer.
Returns:
TRUE on success, FALSE on error.
See also:
SetTimer

BOOL GUIAPI ResetTimer HWND  hWnd,
int  id,
unsigned int  speed
 

Adjusts a timer with a different timeout value.

This function resets a timer with the specified timeout speed value.

Parameters:
hWnd The window owns the timer.
id The identifier of the timer.
speed The new timeout value.
Returns:
TRUE on success, FALSE on error.
See also:
SetTimer

BOOL GUIAPI SetTimer HWND  hWnd,
int  id,
unsigned int  speed
 

Creates a timer with the specified timeout value.

This function creates a timer with the specified timeout value speed. By default, the timeout value is in unit of 10 ms. When the timer expires, an MSG_TIMER message will be send to the window hWnd.

Parameters:
hWnd The window receives the MSG_TIMER message.
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. By default, the timeout value is in unit of 10 ms.
Returns:
TRUE on success, FALSE on error.
Note:
The argument speed may represent the frequency of the timer, or represent the timeout value of the timer. This is depend on the runtime library of MiniGUI. If _TIMER_UNIT_10MS is defined, speed represents the timeout value of the timer, in the unit of 10ms, else is the frequency. If speed represents the frequency of the timer, when it is equal to 10, the timer will expire after every second.
See also:
KillTimer, MSG_TIMER
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 _TIMER_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);
}


Generated on Mon Jun 26 13:54:32 2006 for MiniGUI V1.6.9 API Reference by  doxygen 1.4.2