共用方式為


CFindReplaceDialog::GetNotifier

Call this function to retrieve a pointer to the current Find Replace dialog box.

static CFindReplaceDialog* PASCAL GetNotifier( 
   LPARAM lParam  
);

Parameters

  • lParam
    The lparam value passed to the frame window's OnFindReplace member function.

Return Value

A pointer to the current dialog box.

Remarks

It should be used within your callback function to access the current dialog box, call its member functions, and access the m_fr structure.

Example

See CFindReplaceDialog::Create for an example of how to register the OnFindReplace handler to receive notifications from the Find Replace dialog box.

LRESULT CMyRichEditView::OnFindReplace(WPARAM wparam, LPARAM lparam)
{
   UNREFERENCED_PARAMETER(wparam);

   CFindReplaceDialog *pDlg = CFindReplaceDialog::GetNotifier(lparam);

   if( NULL != pDlg )
   {
      // Use pDlg as a pointer to the existing FindReplace dlg to  
      // call CFindReplaceDialog member functions 
      if(pDlg->IsTerminating())
      {
         CString   csFindString;
         CString   csReplaceString;

         csFindString = pDlg->GetFindString();
         csReplaceString = pDlg->GetReplaceString();

         VERIFY(AfxGetApp()->WriteProfileString( AfxGetApp()->m_pszAppName,
            _T("FindString"), csFindString));
         VERIFY(AfxGetApp()->WriteProfileString(AfxGetApp()->m_pszAppName,
            _T("ReplaceString"), csReplaceString));

         VERIFY(pDlg->DestroyWindow());
      }
   }

   return 0;
}

Requirements

Header: afxdlgs.h

See Also

Reference

CFindReplaceDialog Class

Hierarchy Chart