Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
5.2 KiB

  1. /******************************************************************************
  2. Source File: Child Frame.CPP
  3. This implements the class for MDI child windows' frames in this application.
  4. Our primary change is that in most cases, the frame window is not sizable,
  5. since we use property sheets so extensively.
  6. Copyright (c) 1997 by Microsoft Corporation. All Rights Reserved.
  7. A Pretty Penny Enterprises Production.
  8. Change History:
  9. 02-03-1997 Bob_Kjelgaard@Prodigy.Net Created it
  10. ******************************************************************************/
  11. #include "StdAfx.H"
  12. #if defined(LONG_NAMES)
  13. #include "MiniDriver Developer Studio.H"
  14. #include "Child Frame.H"
  15. #else
  16. #include "MiniDev.H"
  17. #include "ChildFrm.H"
  18. #endif
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CChildFrame
  26. IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
  27. BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
  28. //{{AFX_MSG_MAP(CChildFrame)
  29. // NOTE - the ClassWizard will add and remove mapping macros here.
  30. // DO NOT EDIT what you see in these blocks of generated code !
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CChildFrame construction/destruction
  35. CChildFrame::CChildFrame() {
  36. // TODO: add member initialization code here
  37. }
  38. CChildFrame::~CChildFrame() {
  39. }
  40. BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) {
  41. // TODO: Modify the Window class or styles here by modifying
  42. // the CREATESTRUCT cs
  43. cs.style = WS_CHILD | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
  44. | FWS_ADDTOTITLE ;//| WS_MINIMIZEBOX; // Raid 8350
  45. return CMDIChildWnd::PreCreateWindow(cs);
  46. }
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CChildFrame diagnostics
  49. #ifdef _DEBUG
  50. void CChildFrame::AssertValid() const {
  51. CMDIChildWnd::AssertValid();
  52. }
  53. void CChildFrame::Dump(CDumpContext& dc) const {
  54. CMDIChildWnd::Dump(dc);
  55. }
  56. #endif //_DEBUG
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CChildFrame message handlers
  59. /******************************************************************************
  60. CToolTipPage class implementation
  61. Derive from this class rather than CPropertyPage if you wish to use to use
  62. tool tips on your property page.
  63. ******************************************************************************/
  64. CToolTipPage::CToolTipPage(int id) : CPropertyPage(id) {
  65. //{{AFX_DATA_INIT(CToolTipPage)
  66. // NOTE: the ClassWizard will add member initialization here
  67. //}}AFX_DATA_INIT
  68. m_uHelpID = 0 ;
  69. }
  70. CToolTipPage::~CToolTipPage() {
  71. }
  72. void CToolTipPage::DoDataExchange(CDataExchange* pDX) {
  73. CPropertyPage::DoDataExchange(pDX);
  74. //{{AFX_DATA_MAP(CToolTipPage)
  75. // NOTE: the ClassWizard will add DDX and DDV calls here
  76. //}}AFX_DATA_MAP
  77. }
  78. BEGIN_MESSAGE_MAP(CToolTipPage, CPropertyPage)
  79. //{{AFX_MSG_MAP(CToolTipPage)
  80. //}}AFX_MSG_MAP
  81. ON_NOTIFY(TTN_NEEDTEXT, 0, OnNeedText)
  82. END_MESSAGE_MAP()
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CToolTipPage message handlers
  85. /******************************************************************************
  86. CToolTipPage::OnInitDialog
  87. This message handler is simple- it simply uses CWnd::EnableToolTips to turn
  88. on tool tips for this page.
  89. ******************************************************************************/
  90. BOOL CToolTipPage::OnInitDialog() {
  91. CPropertyPage::OnInitDialog();
  92. EnableToolTips(TRUE);
  93. return TRUE; // return TRUE unless you set the focus to a control
  94. // EXCEPTION: OCX Property Pages should return FALSE
  95. }
  96. /******************************************************************************
  97. CToolTipPage::OnNeedText
  98. This handles the tool tip notification message that tip text is needed. This
  99. notification is handled by using the control's ID as the key to the string
  100. table.
  101. ******************************************************************************/
  102. void CToolTipPage::OnNeedText(LPNMHDR pnmh, LRESULT *plr) {
  103. TOOLTIPTEXT *pttt = (TOOLTIPTEXT *) pnmh;
  104. long lid = ((long) (pttt -> uFlags & TTF_IDISHWND)) ?
  105. (long)GetWindowLong((HWND) pnmh -> idFrom, GWL_ID) : (long)pnmh -> idFrom;
  106. m_csTip.LoadString(lid);
  107. m_csTip.TrimLeft();
  108. m_csTip.TrimRight();
  109. if (m_csTip.IsEmpty())
  110. m_csTip.Format("Window ID is %X", lid);
  111. pttt -> lpszText = const_cast <LPTSTR> ((LPCTSTR) m_csTip);
  112. }
  113. /******************************************************************************
  114. CToolTipPage::PreTranslateMessage
  115. Looks for and process the context sensistive help key (F1) if it is found AND
  116. the class that uses CToolTipPage as a base class has set the help ID.
  117. ******************************************************************************/
  118. BOOL CToolTipPage::PreTranslateMessage(MSG* pMsg)
  119. {
  120. if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F1 && m_uHelpID != 0) {
  121. AfxGetApp()->WinHelp(m_uHelpID) ;
  122. return TRUE ;
  123. } ;
  124. return CPropertyPage::PreTranslateMessage(pMsg);
  125. }