home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / property.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.4 KB  |  69 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   : property.h                                                             //
  12. //  Description: Property sheet page and property sheet                              //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. #include <commctrl.h>
  17.  
  18. #include "dialog.h"
  19.  
  20. // Property Sheet Page
  21. class KPropertySheetPage : protected KDialog
  22. {
  23. public:
  24.     
  25.     HPROPSHEETPAGE createPropertySheetPage(HINSTANCE hInst, int id_Template)
  26.     {
  27.         PROPSHEETPAGE psp;
  28.         
  29.         memset(& psp, 0, sizeof(psp));
  30.  
  31.         psp.dwSize      = sizeof(PROPSHEETPAGE);
  32.         psp.dwFlags     = PSP_DEFAULT;
  33.         psp.hInstance   = hInst;
  34.  
  35.         psp.pszTemplate = MAKEINTRESOURCE(id_Template);
  36.         psp.pfnDlgProc  = DialogProc;
  37.         psp.lParam      = (LPARAM) this;
  38.  
  39.         return CreatePropertySheetPage(&psp);
  40.     }
  41. };
  42.  
  43.  
  44. // Property Sheet
  45. class KPropertySheet
  46. {
  47. public:
  48.     
  49.     int propertySheet(HINSTANCE hInst, HWND hWnd, int id_Icon, int nPages, HPROPSHEETPAGE * hPages, const TCHAR *sCaption)
  50.     {
  51.         PROPSHEETHEADER psh;
  52.  
  53.         memset(& psh, 0, sizeof(PROPSHEETHEADER) );
  54.         
  55.         psh.dwSize      = sizeof(PROPSHEETHEADER);
  56.         psh.dwFlags     = PSH_USEICONID | PSH_NOAPPLYNOW;
  57.         psh.hInstance   = hInst;
  58.         psh.hwndParent  = hWnd;
  59.         psh.pszIcon     = MAKEINTRESOURCE(id_Icon);
  60.         psh.nPages      = nPages;
  61.         psh.phpage      = hPages;
  62.         psh.pszCaption  = sCaption;
  63.         psh.pfnCallback = NULL;
  64.  
  65.         return PropertySheet(& psh);
  66.     }
  67. };
  68.  
  69.