home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / Chapt_05 / Device / Device.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.2 KB  |  82 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   : device.cpp                                                             //
  10. //  Description: Examine Device Context, Chapter 5                                   //
  11. //  Version    : 1.00.000, May 31, 2000                                              //
  12. //-----------------------------------------------------------------------------------//
  13.  
  14. #define STRICT
  15. #define NOCRYPT
  16.  
  17. #include <windows.h>
  18. #include <tchar.h>
  19. #include "resource.h"
  20.  
  21. #include "..\\..\\include\\property.h"
  22. #include "DevPage.h"
  23.  
  24.  
  25. class KMain : public KPropertySheet
  26. {
  27.     KDevicePage * m_Device;
  28.  
  29. public: 
  30.  
  31.     KMain(void)
  32.     {
  33.         m_Device = NULL;
  34.     }
  35.  
  36.     ~KMain(void)
  37.     {
  38.         if ( m_Device )
  39.         {
  40.             delete m_Device;
  41.             m_Device = NULL;
  42.         }
  43.     }
  44.  
  45.     void Run(HINSTANCE hInst)
  46.     {
  47.         HPROPSHEETPAGE hPage[3];
  48.  
  49.         m_Device = new KDevicePage(hInst);
  50.         hPage[0] = m_Device->createPropertySheetPage(hInst, IDD_DEVICEPAGE);
  51.  
  52.         propertySheet(hInst, NULL, 0, 1, hPage, "Device");
  53.     }
  54. };
  55.  
  56.  
  57. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
  58. {
  59.     KMain    main;
  60.     
  61. /*    HDC hDC1 = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
  62.  
  63.     HDC hDC2 = CreateDCW(L"DISPLAY", L"\\\\.\\DISPLAY1", NULL, NULL);
  64.     HDC hDC3 = CreateDCW(NULL, L"\\\\.\\DISPLAY1", NULL, NULL);
  65.     HDC hDC4 = CreateDCW(NULL, L"\\\\.\\DISPLAY3", NULL, NULL);
  66.  
  67.     DEVMODEW Dm;
  68.  
  69.     Dm.dmSize        = sizeof(Dm);
  70.     Dm.dmDriverExtra = 0;
  71.  
  72.     HDC hDC5 = CreateDCW(NULL, L"HP DeskJet 895Cxi", NULL, & Dm);
  73.     
  74.     DeleteDC(hDC1);
  75. */
  76.     InitCommonControls();
  77.  
  78.     main.Run(hInstance);
  79.  
  80.     return TRUE;
  81. }    
  82.