在视图类或者框架类头文件类声明中添加
C***Dlg dlg;
在你需要用到非模态对话框的消息响应函数中
dlg.Create();
例如:dlg.Create(IDD_DLALOG1,this);
dlg.ShowWindow();
例如:dlg.ShowWindow(SW_SHOW);
注意相应的C***Dlg需要改些虚函数OnOK.
CDialog::OnOK
virtual void OnOK( );
Remarks
Called when the user clicks the OK button (the button with an ID of IDOK).
Override this member function to perform the OK button action. If the dialog box includes automatic data validation and exchange, the default implementation of this member function validates the dialog-box data and updates the appropriate variables in your application.
If you implement the OK button in a modeless dialog box, you must override the OnOK member function and call DestroyWindow from within it. Don’t call the base-class member function, because it calls EndDialog, which makes the dialog box invisible but does not destroy it.