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

  1. // chicdial.cpp : implementation file
  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. #include "stdafx.h"
  14.  
  15. #ifdef _DEBUG
  16. #undef THIS_FILE
  17. static char BASED_CODE THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CCSDialog dialog
  22.  
  23. CCSDialog::CCSDialog(UINT nIDTemplate, CWnd* pParentWnd)
  24.     : CDialog(nIDTemplate, pParentWnd)
  25. {
  26. }
  27.  
  28. CCSDialog::CCSDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
  29.     : CDialog(lpszTemplateName, pParentWnd)
  30. {
  31. }
  32.  
  33. CCSDialog::CCSDialog() : CDialog()
  34. {
  35. }
  36.  
  37. BEGIN_MESSAGE_MAP(CCSDialog, CDialog)
  38.     //{{AFX_MSG_MAP(CCSDialog)
  39.     //}}AFX_MSG_MAP
  40.     ON_MESSAGE(WM_HELP, OnHelp)
  41.     ON_MESSAGE(WM_CONTEXTMENU, OnHelpContextMenu)
  42. END_MESSAGE_MAP()
  43.  
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CCSDialog message handlers
  47.  
  48. LONG CCSDialog::OnHelp(UINT, LONG lParam)
  49. {
  50.     ::WinHelp( (HWND)((LPHELPINFO)lParam)->hItemHandle, AfxGetApp()->m_pszHelpFilePath,
  51.         HELP_WM_HELP, (DWORD)(LPVOID)GetHelpIDs());
  52.     return 0;
  53. }
  54.  
  55. LONG CCSDialog::OnHelpContextMenu(UINT wParam, LONG)
  56. {
  57.     ::WinHelp((HWND)wParam, AfxGetApp()->m_pszHelpFilePath,
  58.         HELP_CONTEXTMENU, (DWORD)(LPVOID)GetHelpIDs());
  59.     return 0;
  60. }
  61.  
  62. BOOL CCSDialog::OnInitDialog()
  63. {
  64.     CDialog::OnInitDialog();
  65.     ModifyStyleEx(0, WS_EX_CONTEXTHELP);
  66.     return TRUE;  // return TRUE unless you set the focus to a control
  67.                   // EXCEPTION: OCX Property Pages should return FALSE
  68. }
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CCSPropertyPage
  72.  
  73. CCSPropertyPage::CCSPropertyPage(UINT nIDTemplate, UINT nIDCaption)
  74.     : CPropertyPage(nIDTemplate, nIDCaption)
  75. {
  76. }
  77.  
  78. CCSPropertyPage::CCSPropertyPage(LPCTSTR lpszTemplateName,
  79.     UINT nIDCaption) : CPropertyPage(lpszTemplateName, nIDCaption)
  80. {
  81. }
  82.  
  83. BEGIN_MESSAGE_MAP(CCSPropertyPage, CPropertyPage)
  84.     //{{AFX_MSG_MAP(CCSPropertyPage)
  85.     //}}AFX_MSG_MAP
  86.     ON_MESSAGE(WM_HELP, OnHelp)
  87.     ON_MESSAGE(WM_CONTEXTMENU, OnHelpContextMenu)
  88. END_MESSAGE_MAP()
  89.  
  90.  
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CCSPropertyPage message handlers
  93.  
  94. LONG CCSPropertyPage::OnHelp(UINT, LONG lParam)
  95. {
  96.     ::WinHelp( (HWND)((LPHELPINFO)lParam)->hItemHandle, AfxGetApp()->m_pszHelpFilePath,
  97.         HELP_WM_HELP, (DWORD)(LPVOID)GetHelpIDs());
  98.     return 0;
  99. }
  100.  
  101. LONG CCSPropertyPage::OnHelpContextMenu(UINT wParam, LONG)
  102. {
  103.     ::WinHelp((HWND)wParam, AfxGetApp()->m_pszHelpFilePath,
  104.         HELP_CONTEXTMENU, (DWORD)(LPVOID)GetHelpIDs());
  105.     return 0;
  106. }
  107.  
  108. /////////////////////////////////////////////////////////////////////////////
  109. // CCSPropertySheet
  110.  
  111. BEGIN_MESSAGE_MAP(CCSPropertySheet, CPropertySheet)
  112.     //{{AFX_MSG_MAP(CCSPropertySheet)
  113.     //}}AFX_MSG_MAP
  114.     ON_MESSAGE(WM_HELP, OnHelp)
  115.     ON_MESSAGE(WM_CONTEXTMENU, OnHelpContextMenu)
  116. END_MESSAGE_MAP()
  117.  
  118. CCSPropertySheet::CCSPropertySheet(UINT nIDCaption, CWnd *pParentWnd,
  119.     UINT iSelectPage) : CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
  120. {
  121. }
  122.  
  123. CCSPropertySheet::CCSPropertySheet(LPCTSTR pszCaption, CWnd *pParentWnd,
  124.     UINT iSelectPage) : CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  125. {
  126. }
  127.  
  128. /////////////////////////////////////////////////////////////////////////////
  129. // CCSPropertySheet message handlers
  130.  
  131. LONG CCSPropertySheet::OnHelp(UINT wParam, LONG lParam)
  132. {
  133.     GetActivePage()->SendMessage(WM_HELP, wParam, lParam);
  134.     return 0;
  135. }
  136.  
  137. LONG CCSPropertySheet::OnHelpContextMenu(UINT wParam, LONG lParam)
  138. {
  139.     GetActivePage()->SendMessage(WM_CONTEXTMENU, wParam, lParam);
  140.     return 0;
  141. }
  142.  
  143. BOOL CCSPropertySheet::PreCreateWindow(CREATESTRUCT& cs)
  144. {
  145.     cs.dwExStyle |= WS_EX_CONTEXTHELP;
  146.     return CPropertySheet::PreCreateWindow(cs);
  147. }
  148.