共用方式為


CFindReplaceDialog::CFindReplaceDialog

Constructs a CFindReplaceDialog object.

CFindReplaceDialog();

Remarks

Because the CFindReplaceDialog object is a modeless dialog box, you must construct it on the heap by using the new operator.

During destruction, the framework tries to perform a delete this on the pointer to the dialog box. If you created the dialog box on the stack, the this pointer does not exist and undefined behavior may result.

For more information on the construction of CFindReplaceDialog objects, see the CFindReplaceDialog overview. Use the CFindReplaceDialog::Create member function to display the dialog box.

Example

// m_pFRDlg is a pointer to a class derived from CFindReplaceDialog 
// which defines variables used by the FINDREPLACE structure. 
// InitFindReplaceDlg creates a CFindReplaceDialog and initializes
// the m_fr with the data members from the derived class
void CMyRichEditView::InitFindReplaceDlg() 
{
   if(NULL == m_pFRDlg)
   {
      m_pFRDlg = new CMyFindReplaceDialog();  // Must be created on the heap

      m_pFRDlg->Create(TRUE, _T(""), _T(""), FR_DOWN, this); 

      m_pFRDlg->m_fr.lStructSize = sizeof(FINDREPLACE);
      m_pFRDlg->m_fr.hwndOwner = this->m_hWnd;
      m_pFRDlg->m_fr.lpstrFindWhat = m_pFRDlg->GetFindWhatStr();
      m_pFRDlg->m_fr.lpstrReplaceWith = m_pFRDlg->GetReplaceWithStr();
      m_pFRDlg->m_fr.wFindWhatLen =  m_pFRDlg->GetFindWhatStrLen();
      m_pFRDlg->m_fr.wReplaceWithLen =  m_pFRDlg->GetReplaceWithStrLen();
   }
}

Requirements

Header: afxdlgs.h

See Also

Reference

CFindReplaceDialog Class

Hierarchy Chart

CFindReplaceDialog::Create

Other Resources

CFindReplaceDialog Members