title: MFC: CToolTipCtrl causes ASSERT
body: <p>I have implemented tool tips seemingly successfully in an app which is MFC based and uses CPropertyPage.  However after adding a button to open a dialog box called <code>IDC_USERMSG</code> which contains a single CEdit control on one of the CPropety pages an Assert is thrown when the <code>IDC_USERMSG</code> dialog is dismissed.  </p>
  
  <pre><code>_AFXWIN_INLINE CWnd* CWnd::GetParent() const
  { 
      ASSERT(::IsWindow(m_hWnd)); // Asserts here.
      return CWnd::FromHandle(::GetParent(m_hWnd)); 
  }
  </code></pre>
  
  <p>I belive this is because the IDC_USERMSG dialog no longer exsists at this stage because it has been closed. </p>
  
  <p>Button/Tooltips implimented as follows.</p>
  
  <pre><code>BEGIN_MESSAGE_MAP(CUserData, CPropertyPage)
      // Displays dialog when button pressed    
      ON_BN_CLICKED(IDC_USERMSG, &amp;CUserData::OnBnClickedUsermsgbtn)      
  END_MESSAGE_MAP()
  
  BOOL CUserData::OnInitDialog()    
  {
      EnableToolTips(TRUE);
      static CString ToolTip;  
      CTTCtrl.Create(this); // CToolTipCtrl CTTCtrl is a global
      CTTCtrl.SetDelayTime(TTDT_AUTOPOP, 8000);
      CTTCtrl.SetMaxTipWidth(ToolTipWidth);
  
      ToolTip.LoadStringW(TT_REN);
      CTTCtrl.AddTool( GetDlgItem( IDC_TT_REN), ToolTip );
  
      return 0;
  }   
  
  BOOL CUserData::PreTranslateMessage(MSG* pMsg)
  {
      CTTCtrl.RelayEvent( pMsg );
      CDialog::PreTranslateMessage(pMsg);
  
      // think I need some sort of filter here.
  
      return CDialog::PreTranslateMessage(pMsg);
  }
  </code></pre>
  
  <p>Call Stack</p>
  
  <pre><code>mfc90ud.dll!CWnd::GetParent()  Line 297 + 0x2d bytes    C++
  mfc90ud.dll!CWnd::FilterToolTipMessage(tagMSG * pMsg=0x00155570)  Line 392 + 0x8 bytes  C++
  mfc90ud.dll!CWnd::_FilterToolTipMessage(tagMSG * pMsg=0x00155570, CWnd * pWnd=0x0012fa78)  Line 374 C++
  mfc90ud.dll!CWnd::PreTranslateMessage(tagMSG * pMsg=0x00155570)  Line 1070  C++
  mfc90ud.dll!CDialog::PreTranslateMessage(tagMSG * pMsg=0x00155570)  Line 56 + 0xc bytes C++
  MyApp.exe!CUserData::PreTranslateMessage(tagMSG * pMsg=0x00155570)  Line 495    C++
  </code></pre>