home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / gditable.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-12  |  2.5 KB  |  94 lines

  1. #pragma once
  2.  
  3. //-----------------------------------------------------------------------------------//
  4. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  5. //                             ISBN  0-13-086985-6                                   //
  6. //                                                                                   //
  7. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  8. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  9. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  10. //                                                                                   //
  11. //  FileName   : gditable.h                                                             //
  12. //  Description: NT/2000 GDI handle table access                                     //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. typedef struct
  17. {
  18.     void          *  pKernel;
  19.     unsigned short  _nProcess; // NT/200 switch order for _nProcess, _nCount
  20.     unsigned short  _nCount;
  21.     unsigned short   nUpper;
  22.     unsigned short   nType;
  23.     void          *  pUser;
  24. } GDITableCell;
  25.  
  26.  
  27. // GDI Object Table
  28. class KGDITable
  29. {
  30.     int               m_nVersion;
  31.     
  32.     GDITableCell * pGDITable;
  33.  
  34. public:
  35.  
  36.     bool IsGDITableAccessible(void) const
  37.     {
  38.         return pGDITable != NULL;
  39.     }
  40.  
  41.     KGDITable();
  42.  
  43.     GDITableCell operator[](HGDIOBJ hHandle) const
  44.     {
  45.         return pGDITable[ (unsigned) hHandle & 0xFFFF ];
  46.     }
  47.  
  48.     GDITableCell operator[](unsigned nIndex) const
  49.     {
  50.         return pGDITable[ nIndex & 0xFFFF ];
  51.     }
  52.  
  53.     unsigned short GetProcess(unsigned nIndex) const
  54.     {
  55.         const GDITableCell & cell = pGDITable[nIndex & 0xFFFF];
  56.  
  57.         if ( m_nVersion==5 )
  58.             return cell._nProcess;
  59.         else
  60.             return cell._nCount;
  61.     }
  62.  
  63.     unsigned short GetCount(unsigned nIndex) const
  64.     {
  65.         const GDITableCell & cell = pGDITable[nIndex & 0xFFFF];
  66.  
  67.         if ( m_nVersion==5 )
  68.             return cell._nCount;
  69.         else
  70.             return cell._nProcess;
  71.     }
  72.  
  73.     unsigned short GetProcess(HGDIOBJ nIndex) const
  74.     {
  75.         const GDITableCell & cell = pGDITable[(DWORD) nIndex & 0xFFFF];
  76.  
  77.         if ( m_nVersion==5 )
  78.             return cell._nProcess;
  79.         else
  80.             return cell._nCount;
  81.     }
  82.  
  83.     unsigned short GetCount(HGDIOBJ nIndex) const
  84.     {
  85.         const GDITableCell & cell = pGDITable[(DWORD) nIndex & 0xFFFF];
  86.  
  87.         if ( m_nVersion==5 )
  88.             return cell._nCount;
  89.         else
  90.             return cell._nProcess;
  91.     }
  92.  
  93. };
  94.