apphelpx.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #include "stdafx.h"
  11. #ifdef AFX_CORE3_SEG
  12. #pragma code_seg(AFX_CORE3_SEG)
  13. #endif
  14. #ifdef _DEBUG
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. // Basic Help support (for backward compatibility to MFC 2.0)
  20. void CWinApp::OnHelp() // use context to derive help context
  21. {
  22. if (m_dwPromptContext != 0)
  23. {
  24. // do not call WinHelp when the error is failing to lauch help
  25. if (m_dwPromptContext != HID_BASE_PROMPT+AFX_IDP_FAILED_TO_LAUNCH_HELP)
  26. WinHelp(m_dwPromptContext);
  27. return;
  28. }
  29. // otherwise, use CWnd::OnHelp implementation
  30. CWnd* pWnd = AfxGetMainWnd();
  31. ASSERT_VALID(pWnd);
  32. if (!pWnd->IsFrameWnd())
  33. pWnd->OnHelp();
  34. else
  35. ((CFrameWnd*)pWnd)->OnHelp();
  36. }
  37. void CWinApp::OnHelpIndex()
  38. {
  39. WinHelp(0L, HELP_INDEX);
  40. }
  41. void CWinApp::OnHelpFinder()
  42. {
  43. WinHelp(0L, HELP_FINDER);
  44. }
  45. void CWinApp::OnHelpUsing()
  46. {
  47. WinHelp(0L, HELP_HELPONHELP);
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Context Help Mode support (backward compatibility to MFC 2.0)
  51. void CWinApp::OnContextHelp()
  52. {
  53. // just use CFrameWnd::OnContextHelp implementation
  54. m_bHelpMode = HELP_ACTIVE;
  55. CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();
  56. ASSERT_VALID(pMainWnd);
  57. ASSERT_KINDOF(CFrameWnd, pMainWnd);
  58. pMainWnd->OnContextHelp();
  59. m_bHelpMode = pMainWnd->m_bHelpMode;
  60. pMainWnd->PostMessage(WM_KICKIDLE); // trigger idle update
  61. }
  62. /////////////////////////////////////////////////////////////////////////////