다음을 통해 공유


SetTimer_I (Windows Embedded CE 6.0)

1/6/2010

This function creates a timer with the specified time-out value.

Syntax

UINT WINAPI SetTimer_I(
  HWND hwnd,
  UINT idTimer,
  UINT uTimeout,
  TIMERPROC tmprc
);

Parameters

  • hwnd
    [in] Handle to the window that you want to associate with the timer. The calling thread must own this window. If this parameter is NULL, SetTimer_I does not associate a window with the timer and ignores the idTimer parameter.
  • idTimer
    [in] Unsigned integer that specifies a nonzero identifier for the timer. If the hwnd parameter is NULL, SetTimer_I ignores this parameter.
  • uTimeout
    [in] Unsigned integer that specifies the time-out value, in milliseconds.
  • tmprc
    [in] Long pointer to the callback function that you want the OS to notify when the time-out value elapses. For more information about the callback function, see TimerProc. If tmprc is NULL, the OS posts a WM_TIMER message to the application queue instead of calling a callback function. The hwnd member of the MSG structure for that message contains the value of the hwnd parameter of SetTimer_I.

Return Value

An integer that identifies the new timer indicates success. An application can pass this value or the string identifier, if the identifier exists, to the KillTimer_I function to destroy the timer. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

If you set the uTimeout parameter to INFINITE, KillTimer_I fails to destroy the timer.

An application can process WM_TIMER messages either by including a case statement for WM_TIMER in the window procedure or by specifying a TimerProc callback function when the application creates the timer. When the application specifies a TimerProc callback function, the default window procedure calls the callback function when the default window procedure processes WM_TIMER messages. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.

The wParam parameter of the WM_TIMER message contains the value of the idTimer parameter.

Requirements

Header gwebypasscoredllthunk.hpp
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

GWES OS Functions
KillTimer_I
MSG
SetTimer
TimerProc
WM_TIMER