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

  1. //-----------------------------------------------------------------------------------//
  2. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  3. //                             ISBN  0-13-086985-6                                   //
  4. //                                                                                   //
  5. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  6. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  7. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  8. //                                                                                   //
  9. //  FileName   : gditable.cpp                                                         //
  10. //  Description: Accesing GDI handle table                                           //
  11. //  Version    : 1.00.000, May 31, 2000                                              //
  12. //-----------------------------------------------------------------------------------//
  13.  
  14. #define STRICT
  15. #include <windows.h>
  16. #include <assert.h>
  17. #include <tchar.h>
  18.  
  19. #include "gditable.h"
  20.  
  21.  
  22. KGDITable::KGDITable()
  23. {
  24.     typedef unsigned (CALLBACK * Proc0) (void);
  25.  
  26.     HMODULE hGDI = GetModuleHandle(_T("GDI32.dll"));
  27.     assert(hGDI);
  28.  
  29.     Proc0 pGdiQueryTable = (Proc0) GetProcAddress(hGDI, "GdiQueryTable");
  30.     assert(pGdiQueryTable);
  31.  
  32.     if ( pGdiQueryTable )
  33.         pGDITable = (GDITableCell *) pGdiQueryTable();
  34.     else
  35.     {
  36.         pGDITable = NULL;
  37.     
  38.         MessageBox(NULL, "Unable to locate handle table", "KGDITable", MB_OK | MB_ICONSTOP);
  39.         PostQuitMessage(-1);
  40.     }
  41.  
  42.     DWORD dwVersion = GetVersion();
  43.  
  44.     if (dwVersion < 0x80000000)                // Windows NT/2000
  45.         m_nVersion = LOBYTE(LOWORD(dwVersion));
  46.     else
  47.         m_nVersion = 0;
  48. }
  49.