Jump to content

WinStartTimer: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== WinStartTimer ==
Start the timer as identified as timerID.
; WinStartTimer(anchorHndl, windowHndl, timerID, timeout) : Start the timer as identified as timerID.
 
==Syntax==
WinStartTimer (anchorHndl, windowHndl, timerID, timeout)


=== Parameters ===
=== Parameters ===
; anchorHndl - [[OS2_API:DataType:HAB|HAB]] - input : The anchor block handle.
;anchorHndl - [[HAB]] - input : The anchor block handle.
; windowHndl - [[OS2_API:DataType:HWND|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]] paramter is set to NULLHANDLE.
A [[OS2 API:DataType:NULLHANDLE|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 [[OS2_API:DataType:QMSG|QMSG]] paramter is set to [[OS2_API:DataType:NULLHANDLE|NULLHANDLE]].
;timerID - [[ULONG]] - input : The timer identifier.
; timerID - [[OS2 API:DataType:ULONG|ULONG]] - input : The timer identifier.
: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.
This value must be below [[OS2 API:Constant:TID#TID_USERMAX|TID_USERMAX]]. Any value above this could clash with system timers.
:The [[TID#TID_CURSOR|TID_CURSOR]] identity, is create by the cursor is flashing. The application must pass the associated <tt>WM_TIMER</tt> onto the default window procedure.
 
;timeout - [[ULONG]] - input : The delay time in milliseconds.
The [[OS2 API:Constant:TID#TID_SCROLL|TID_SCROLL]] identity, is created by the scroll bar control. An application typically doesn't see the associated [[OS2_API:Constant:WM#WM_TIMER|WM_TIMER]], which is passed to the scroll-bar control.
: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.
The [[OS2 API:Constant:TID#TID_CURSOR|TID_CURSOR]] identity, is create by the cursor is flashing. The application must pass the associated [[OS2_API:Constant:WM#WM_TIMER|WM_TIMER]] onto the default window procedure.
; timeout - [[OS2 API:DataType:ULONG|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.
 
=== Constants ===


=== Returns ===
=== Returns ===
Returns [[OS2_API:DataType:ULONG|ULONG]]:
Returns [[ULONG]]:
* 0 An error has occurred.
* 0 An error has occurred.
* Anything else - the timerID.
* Anything else - the timerID.
=== Module ===


=== Define (C/C++) ===
=== Define (C/C++) ===
INCL_WINTIMER or INCL_PM or INCL_WIN
INCL_WINTIMER or INCL_PM or INCL_WIN


=== Export name/Ordinal ===
=== Calling Convention ===
 
=== Calling conversion ===
[[Cdecl32]]
[[Cdecl32]]


=== Example Code ===
=== Example Code ===
  [[OS2 API:DataType:HAB|HAB]]   anchorHndl;
  HAB    anchorHndl;
  [[OS2 API:DataType:HWND|HWND]]   windowHndl;
  HWND  windowHndl;
  [[OS2 API:DataType:ULONG|ULONG]] timerID;
  ULONG  timerID;
  [[OS2 API:DataType:ULONG|ULONG]] timeout;
  ULONG  timeout;
  [[OS2 API:DataType:ULONG|ULONG]] timerIDStarted;
  ULONG  timerIDStarted;
  ...
  ...
  timerIDStarted = WinStartTimer(anchorHndl, windowHndl, timerID, timeout);
  timerIDStarted = WinStartTimer(anchorHndl, windowHndl, timerID, timeout);
Line 48: Line 38:


=== Related Functions ===
=== Related Functions ===
[[OS2 API:WinGetCurrentTime|WinGetCurrentTime]] [[OS2_API:WinQueryMsgTime|WinQueryMsgTime]] [[OS2_API:WinStopTimer|WinStopTimer]]
*[[WinGetCurrentTime]]
*WinQueryMsgTime
*[[WinStopTimer]]


=== Notes ===
=== Notes ===
[[OS2 API:WinStartTimer|WinStartTimer]] creates a timer identified by <code>windowHndl</code> and <code>timerID</code>, set to time out every <code>timeout</code> milliseconds. When a timer times out, a [[OS2_API:Constant:WM#WM_TIMER|WM_TIMER]] message is posted.
WinStartTimer creates a timer identified by <tt>windowHndl</tt> and <tt>timerID</tt>, set to time out every <tt>timeout</tt> milliseconds. When a timer times out, a <tt>WM_TIMER</tt> message is posted.


The <code>timeout</code> value of zero causes the timer to timeout as fast as possible; this is about 1/18 second.
The <tt>timeout</tt> 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.
A second call to this function, for a timer that already exists, resets that timer.


=== OS Version Introduced ===
[[Category:Win]]
 
 
 
[[OS2_API | Back to OS/2 API]]
 
 
[[Category:The OS/2 API Project]]

Latest revision as of 19:00, 6 January 2023

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 paramter 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 create 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

Returns ULONG:

  • 0 An error has occurred.
  • Anything else - the timerID.

Define (C/C++)

INCL_WINTIMER or INCL_PM or INCL_WIN

Calling Convention

Cdecl32

Example Code

HAB    anchorHndl;
HWND   windowHndl;
ULONG  timerID;
ULONG  timeout;
ULONG  timerIDStarted;
...
timerIDStarted = WinStartTimer(anchorHndl, windowHndl, timerID, timeout);
...

Related Functions

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.