home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ICLUI.ZIP
/
HELLO6
/
ATIMEHDR.CPP
< prev
next >
Wrap
Text File
|
1993-02-23
|
5KB
|
81 lines
/******************************************************************************/
/* HELLO WORLD SAMPLE PROGRAM - Version 6: Class Implementation (ATIMEHDR.CPP)*/
/* */
/* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1993. */
/* */
/* DISCLAIMER OF WARRANTIES: */
/* The following [enclosed] code is sample code created by IBM */
/* Corporation. This sample code is not part of any standard IBM product */
/* and is provided to you solely for the purpose of assisting you in the */
/* development of your applications. The code is provided "AS IS", */
/* without warranty of any kind. IBM shall not be liable for any damages */
/* arising out of your use of the sample code, even if they have been */
/* advised of the possibility of such damages. */
/******************************************************************************/
// NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE
//**************************************************************************
// The entire file was created at version 6 *
//**************************************************************************
#include <ithread.hpp> //IThread for Timer Call to PM
#include <iwindow.hpp> //IWindow
#define INCL_WINTIMER //Include OS/2 Timer Calls
#include <os2.h> //os2.h to call beep if error
#include "atimehdr.hpp" //Include ATimeHandler Class header
//**************************************************************************
// ATimeHandler :: handleEventsFor(...) *
// handleEventsFor *
//**************************************************************************
IHandler & ATimeHandler :: handleEventsFor( IWindow *window )
{
if (window) //Is Window been Specified?
{ //
WinStartTimer( //Start Timer
(HAB)IThread::current().anchorBlock(),//Anchor Block (HAB in PM)
(HWND)window->handle(), //Return Window Handle
1, //Timer ID
1000UL); //Set to tick every second
} /* endif */ //
return IHandler::handleEventsFor(window);//Call my parent for processing
} /* end ATimeHandler :: handleEventsFor(...) */
//**************************************************************************
// ATimeHandler :: stopHandlingEventsFor(...) *
// handleEventsFor *
//**************************************************************************
IHandler & ATimeHandler :: stopHandlingEventsFor(IWindow *window )
{
if (window) //Is Window been Specified?
{ //
WinStopTimer( //Stop Timer
(HAB)IThread::current().anchorBlock(),//Anchor Block (HAB in PM)
(HWND)window->handle(), //Return Window Handle
1); //Timer ID
} /* endif */ //
return IHandler::stopHandlingEventsFor(window);//Call my parent for processing
} /* end ATimeHandler :: stopHandlingEventsFor(...) */
//**************************************************************************
// ATimeHandler :: tick(IEvent& evt) *
// Tick Event *
//**************************************************************************
Boolean ATimeHandler :: tick(IEvent& evt)//Default Tick Processing
{ //
return false; //Return true
} /* end ATimeHandler :: stopTimer() */
/**************************************************************/
/* Dispatch command functions for this handler. */
/**************************************************************/
Boolean ATimeHandler::dispatchHandlerEvent(IEvent& evt)
{
if ((evt.eventId() == WM_TIMER) && //Is this a WM_TIMER Event and
(evt.parameter1() == 1)) // Is this our TimerID?
{ // Yes, this is a WM_TIMER Event
return tick(evt); //Call Tick and Return
} /* endif */ //
return false; //Return Command not Processed
} /* end ATimeHandler :: dispatchHandlerEvent(IEvent& evt) */