WinStartTimer: Difference between revisions
Appearance
mNo edit summary |
mNo edit summary |
||
| Line 7: | Line 7: | ||
;anchorHndl - [[HAB]] - input : The anchor block handle. | ;anchorHndl - [[HAB]] - input : The anchor block handle. | ||
;windowHndl - [[HWND]] - input : The window handle. | ;windowHndl - [[HWND]] - input : The window handle. | ||
:A [[NULLHANDLE]] parameter renders timerID ignored. The function will return a unique, non-zero identity to represent the timer. A timer message is posted into the message queue associated with the current thread. The [[QMSG]] | :A [[NULLHANDLE]] parameter renders timerID ignored. The function will return a unique, non-zero identity to represent the timer. A timer message is posted into the message queue associated with the current thread. The [[QMSG]] parameter is set to NULLHANDLE. | ||
;timerID - [[ULONG]] - input : The timer identifier. | ;timerID - [[ULONG]] - input : The timer identifier. | ||
:This value must be below [[TID#TID_USERMAX|TID_USERMAX]]. Any value above this could clash with system timers. | :This value must be below [[TID#TID_USERMAX|TID_USERMAX]]. Any value above this could clash with system timers. | ||
:The [[TID#TID_SCROLL|TID_SCROLL]] identity, is created by the scroll bar control. An application typically doesn't see the associated <tt>WM_TIMER</tt>, which is passed to the scroll-bar control. | :The [[TID#TID_SCROLL|TID_SCROLL]] identity, is created by the scroll bar control. An application typically doesn't see the associated <tt>WM_TIMER</tt>, which is passed to the scroll-bar control. | ||
:The [[TID#TID_CURSOR|TID_CURSOR]] identity, is | :The [[TID#TID_CURSOR|TID_CURSOR]] identity, is created by the cursor is flashing. The application must pass the associated <tt>WM_TIMER</tt> onto the default window procedure. | ||
;timeout - | ;timeout - ULONG - input : The delay time in milliseconds. | ||
:For OS/2 Warp 3 and above, the valid value range is 0-4,294,967,295. | :For OS/2 Warp 3 and above, the valid value range is 0-4,294,967,295. | ||
:For OS/2 2.1 and earlier, the valid value range is 0-65,535. | :For OS/2 2.1 and earlier, the valid value range is 0-65,535. | ||
=== Returns === | === Returns === | ||
ReturnsULONG: | |||
* 0 An error has occurred. | * 0 An error has occurred. | ||
* Anything else - the timerID. | * Anything else - the timerID. | ||
Latest revision as of 16:36, 26 October 2025
Start the timer as identified as timerID.
Syntax
WinStartTimer (anchorHndl, windowHndl, timerID, timeout)
Parameters
- anchorHndl - HAB - input
- The anchor block handle.
- windowHndl - HWND - input
- The window handle.
- A NULLHANDLE parameter renders timerID ignored. The function will return a unique, non-zero identity to represent the timer. A timer message is posted into the message queue associated with the current thread. The QMSG parameter is set to NULLHANDLE.
- timerID - ULONG - input
- The timer identifier.
- This value must be below TID_USERMAX. Any value above this could clash with system timers.
- The TID_SCROLL identity, is created by the scroll bar control. An application typically doesn't see the associated WM_TIMER, which is passed to the scroll-bar control.
- The TID_CURSOR identity, is created by the cursor is flashing. The application must pass the associated WM_TIMER onto the default window procedure.
- timeout - ULONG - input
- The delay time in milliseconds.
- For OS/2 Warp 3 and above, the valid value range is 0-4,294,967,295.
- For OS/2 2.1 and earlier, the valid value range is 0-65,535.
Returns
ReturnsULONG:
- 0 An error has occurred.
- Anything else - the timerID.
Define (C/C++)
INCL_WINTIMER or INCL_PM or INCL_WIN
Calling Convention
Example Code
HAB anchorHndl; HWND windowHndl; ULONG timerID; ULONG timeout; ULONG timerIDStarted; ... timerIDStarted = WinStartTimer(anchorHndl, windowHndl, timerID, timeout); ...
Related Functions
- WinGetCurrentTime
- WinQueryMsgTime
- WinStopTimer
Notes
WinStartTimer creates a timer identified by windowHndl and timerID, set to time out every timeout milliseconds. When a timer times out, a WM_TIMER message is posted.
The timeout value of zero causes the timer to timeout as fast as possible; this is about 1/18 second.
A second call to this function, for a timer that already exists, resets that timer.