home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / Chapt_03 / Handles / Main.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.3 KB  |  78 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   : main.cpp                                                             //
  10. //  Description: GDI Handles main program, Chapter 3                                 //
  11. //  Version    : 1.00.000, May 31, 2000                                              //
  12. //-----------------------------------------------------------------------------------//
  13.  
  14. #define STRICT
  15.  
  16. #include <windows.h>
  17. #include <tchar.h>
  18. #include <assert.h>
  19. #include <commctrl.h>
  20.  
  21. #include "gditable.h"
  22.  
  23. #include "resource.h"
  24. #include "creator.h"
  25. #include "snapshot.h"
  26. #include "handles.h"
  27. #include "findtab.h"
  28. #include "dcdtable.h"
  29.  
  30.  
  31. class KMain : public KPropertySheet
  32. {
  33.     KHGDIOBJ            m_HGDIOBJ;
  34.     KLocateGdiTablePage m_FindTable;
  35.     KDecodeTablePage    m_DecodeTable;
  36.  
  37. public: 
  38.  
  39.     void Run(HINSTANCE hInst)
  40.     {
  41.         if ( ! m_DecodeTable.IsGDITableAccessible() )
  42.             return;
  43.  
  44.         HPROPSHEETPAGE hPage[3];
  45.  
  46.         m_FindTable.Initialize(hInst);
  47.         m_DecodeTable.m_hInst = hInst;
  48.  
  49.         hPage[0] = m_HGDIOBJ.createPropertySheetPage(hInst, IDD_DECODEHANDLE);
  50.         hPage[1] = m_FindTable.createPropertySheetPage(hInst, IDD_LOCATETABLE);
  51.         hPage[2] = m_DecodeTable.createPropertySheetPage(hInst, IDD_DECODETABLE);
  52.  
  53.         TCHAR Title[MAX_PATH];
  54.         wsprintf(Title, "GDI Handles - (process 0x%X)", GetCurrentProcessId());
  55.         
  56.         propertySheet(hInst, NULL, IDI_GDIHANDLES, 3, hPage, Title);
  57.     }
  58.  
  59. };
  60.  
  61. void Test(void);
  62.  
  63. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
  64. {
  65.     KMain    main;
  66.  
  67.     GetStockObject(BLACK_PEN);
  68.  
  69.     Test();
  70.  
  71.     InitCommonControls();
  72.  
  73.  
  74.     main.Run(hInstance);
  75.  
  76.     return TRUE;
  77. }    
  78.