home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / ole / tstcon / pchngpg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.5 KB  |  109 lines

  1. // PropertyChangesPage.Cpp : implementation file
  2. //
  3.  
  4. #include "StdAfx.H"
  5. #include "TestCon.H"
  6. #include "Resource.hm"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CPropertyChangesPage property page
  16.  
  17. IMPLEMENT_DYNCREATE(CPropertyChangesPage, CPropertyPage)
  18.  
  19. CPropertyChangesPage::CPropertyChangesPage() :
  20.    CPropertyPage( CPropertyChangesPage::IDD )
  21. {
  22.    m_psp.dwFlags &= ~PSP_HASHELP;
  23.  
  24.     //{{AFX_DATA_INIT(CPropertyChangesPage)
  25.         // NOTE: the ClassWizard will add member initialization here
  26.     //}}AFX_DATA_INIT
  27. }
  28.  
  29. CPropertyChangesPage::~CPropertyChangesPage()
  30. {
  31. }
  32.  
  33. void CPropertyChangesPage::DoDataExchange( CDataExchange* pDX )
  34. {
  35.    int iProperty;
  36.    int iItem;
  37.  
  38.     CPropertyPage::DoDataExchange( pDX );
  39.     //{{AFX_DATA_MAP(CPropertyChangesPage)
  40.     DDX_Control(pDX, IDC_PROPERTIES_CHANGES, m_lbProperties);
  41.     //}}AFX_DATA_MAP
  42.  
  43.    if( m_lbProperties.GetCount() > 0 )
  44.    {
  45.       for( iProperty = 0; iProperty < m_astrPropertyNames.GetSize();
  46.          iProperty++ )
  47.       {
  48.          iItem = m_lbProperties.FindStringExact( -1, m_astrPropertyNames[
  49.             iProperty] );
  50.          ASSERT( iItem != LB_ERR );
  51.          if( pDX->m_bSaveAndValidate )
  52.          {
  53.             m_atLogFlags[iProperty] = m_lbProperties.GetCheck( iItem );
  54.          }
  55.          else
  56.          {
  57.             m_lbProperties.SetCheck( iItem, m_atLogFlags[iProperty] != FALSE );
  58.          }
  59.       }
  60.    }
  61. }
  62.  
  63.  
  64. BEGIN_MESSAGE_MAP(CPropertyChangesPage, CPropertyPage)
  65.     //{{AFX_MSG_MAP(CPropertyChangesPage)
  66.     ON_WM_HELPINFO()
  67.     ON_WM_CONTEXTMENU()
  68.     //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70.  
  71. /////////////////////////////////////////////////////////////////////////////
  72. // CPropertyChangesPage message handlers
  73.  
  74. BOOL CPropertyChangesPage::OnInitDialog()
  75. {
  76.    int iProperty;
  77.  
  78.     CPropertyPage::OnInitDialog();
  79.  
  80.    for( iProperty = 0; iProperty < m_astrPropertyNames.GetSize(); iProperty++ )
  81.    {
  82.       m_lbProperties.AddString( m_astrPropertyNames[iProperty] );
  83.    }
  84.  
  85.    UpdateData( FALSE );
  86.  
  87.     return( TRUE );
  88. }
  89.  
  90.  
  91. static DWORD rgmapCHID[] =
  92. {
  93.    IDC_PROPERTIES_CHANGES, HIDC_PROPERTIES_CHANGES,
  94.    0, 0
  95. };
  96.  
  97. BOOL CPropertyChangesPage::OnHelpInfo( HELPINFO* pHelpInfo )
  98. {
  99.    return( ::WinHelp( HWND( pHelpInfo->hItemHandle ),
  100.       AfxGetApp()->m_pszHelpFilePath, HELP_WM_HELP, DWORD( LPVOID(
  101.       rgmapCHID ) ) ) );
  102. }
  103.  
  104. void CPropertyChangesPage::OnContextMenu( CWnd* pWnd, CPoint /* point */ )
  105. {
  106.    ::WinHelp( HWND( *pWnd ), AfxGetApp()->m_pszHelpFilePath, HELP_CONTEXTMENU,
  107.       DWORD( LPVOID( rgmapCHID ) ) );
  108. }
  109.