home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / classlib / chourgls.cpp < prev    next >
C/C++ Source or Header  |  1995-05-03  |  1KB  |  57 lines

  1. /*
  2.  * CHOURGLS.CPP
  3.  * Sample Code Class Libraries
  4.  *
  5.  * Implementation of the CHourglass class.
  6.  *
  7.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  8.  *
  9.  * Kraig Brockschmidt, Microsoft
  10.  * Internet  :  kraigb@microsoft.com
  11.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  12.  */
  13.  
  14.  
  15. #include <windows.h>
  16. #include "classlib.h"
  17.  
  18.  
  19. /*
  20.  * CHourglass::CHourglass
  21.  * CHourglass::~CHourglass
  22.  *
  23.  * Constructor Parameters (optional):
  24.  *  hWnd            HWND of a window that wants capture.  Can
  25.  *                  be NULL in which case it is ignored.
  26.  */
  27.  
  28. CHourglass::CHourglass(void)
  29.     {
  30.     m_hCur=SetCursor(LoadCursor(NULL, IDC_WAIT));
  31.     m_hWndCapture=NULL;
  32.     return;
  33.     }
  34.  
  35. CHourglass::CHourglass(HWND hWnd)
  36.     {
  37.     m_hCur=SetCursor(LoadCursor(NULL, IDC_WAIT));
  38.  
  39.     if (NULL!=hWnd)
  40.         {
  41.         m_hWndCapture=hWnd;
  42.         SetCapture(hWnd);
  43.         }
  44.  
  45.     return;
  46.     }
  47.  
  48.  
  49. CHourglass::~CHourglass(void)
  50.     {
  51.     if (NULL!=m_hWndCapture)
  52.         ReleaseCapture();
  53.  
  54.     SetCursor(m_hCur);
  55.     return;
  56.     }
  57.