This example uses the WinStopTimer call to stop a clock after one minute.

#define INCL_WINTIMER
#include <OS2.H>
HAB hab;              /* anchor-block handle. */
ULONG  ulTimerId;
HWND hwnd;
ulTimerId = WinStartTimer(hab,
              (HWND)0,
                    0, /* ignored because previous parameter */
                       /* is null.                           */
                    1000UL);

BOOL WndProc(. . . . ) {
static ULONG seconds;

  switch(msg)
  {
   case WM_TIMER:
     if (seconds) {
       seconds ++ ;
       if (seconds == 60) WinStopTimer(hab, hwnd, ulTimerId);
     }
     break;
   case WM_CREATE:
     seconds = 0;
        .
        .
        .

}


[Back] [Next]