home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / dlgtempl / itemtemp.h < prev    next >
C/C++ Source or Header  |  1998-03-26  |  2KB  |  59 lines

  1. // itemtemp.h
  2.  
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. #ifndef INC_ITEMTEMP_H
  15. #define INC_ITEMTEMP_H
  16.  
  17. // if you change the value for TOTALITEMS, make sure that the allocations
  18. // in CMyDialogTemplate::DemoIt remain consistent with your changes.  Otherwise you might
  19. // end up corrupting the heap.
  20.  
  21. #define TOTALITEMS  3
  22.  
  23. #define IBUTTON         0
  24. #define IEDITCONTROL    1
  25. #define ISTATICTEXT     2
  26.  
  27. // There is no reason to derive a class from CObject because in this specific
  28. // sample application there will be no serialization.
  29. class CDialogItem
  30. {
  31. public:
  32.     // define the enum with values to match whatever DLGITEMTEMPLATE requires
  33.  
  34.     DLGITEMTEMPLATE  m_dlgItemTemplate;
  35.  
  36.     enum            controltype {BUTTON = 0x0080, EDITCONTROL, STATICTEXT};
  37.     controltype     m_controltype;
  38.     CString         m_strCaption;
  39.  
  40. public:
  41.     CDialogItem(enum controltype cType);  // default constructor will fill in default values
  42.     CDialogItem() {};  // default constructor, not to be called directly
  43.  
  44.     void Initialize(enum controltype cType, UINT nID, CRect* prect = NULL, LPCTSTR pszCaption = NULL);
  45. };
  46.  
  47. class CMyDialogTemplate
  48. {
  49. public:
  50.  
  51.     DLGTEMPLATE m_dlgTempl;
  52.     CDialogItem m_rgDlgItem[3];  // the 3 controls to be inserted
  53.  
  54.     CMyDialogTemplate();
  55.     void DemoIt();  // build the template and run it.
  56. };
  57.  
  58. #endif
  59.