In the non-Doc source file Call dialog box, first set up a dialog box, define classes, variables and header file source files and so on. Because when you start to create a dialog box, you are not setting up a separate dialog box.
In order to refer to the contents of his CPP directly in the dialog box and modify the header and source files of the dialog box:
(To be exact, do not know what the benefits of this, if there are ideas welcome message!) Thank you! )
//=========== header File C_latticetransfdlg.h#include"resource.h"#include"Mylattice.h"//= = The file to which the dialog box is referencedclassC_latticetransfdlg: Publiccdialogex{declare_dynamic (C_LATTICETRANSFDLG) Public: C_latticetransfdlg (Cmylattice* Thelatticepos, cwnd* pparent = NULL);//Standard constructor ===== here constructor add Mylattice class Virtual~C_latticetransfdlg (); #ifdef Afx_design_time//= = If the non-modal dialog needs to remove the ifdef conditional compiler enum{IDD =Idd_transformdlg}; #endif}...//============ source file c_latticetransfdlg.cpp====#include"stdafx.h"#include"liu_occ.h"#include"c_latticetransf.h"#include"afxdialogex.h"C_latticetransfdlg::c_latticetransfdlg (Cmylattice* Thelatticepos, cwnd* pparent/*=null*/)//= = = Constructor function: CDialogEx (Idd_transformdlg, pparent), M_tx (0), M_ty (0), M_tz (0), M_rx (0), M_ry (0), M_rz (0), Iscomplete (false) {Mylatticepos=Thelatticepos;} C_latticetransfdlg::~C_latticetransfdlg () {} ...
To invoke a dialog box in another file:
After the dialog header file is included,
#include "c_latticetransf.h"  
void Cmylattice::test5 () {C_latticetransfdlg * Latticetransfdlg; Latticetransfdlg = new C_latticetransfdlg ( this ->domodal (); = = modal Dialog open mode
// latticetransfdlg- >create (C_latticetransfdlg::idd, NULL);//== if the Non-modal dialog box uses the following statement // latticetransfdlg->showwindow (sw_show); float tx = Latticetransfdlg->TX; float rx = Latticetransfdlg->RX;}
The default is as follows, which can be referenced in other CPP:
//= = = Header FileclassC_latticetransfdlg: Publiccdialogex{declare_dynamic (C_LATTICETRANSFDLG) Public: C_latticetransfdlg (CWnd* pparent = NULL);//Standard Constructors Virtual~C_latticetransfdlg ();//dialog box Data#ifdef Afx_design_time//enum {IDD = idd_dialog4}; enum{IDD =Idd_transformdlg};#endif...}//= = = Source fileC_latticetransfdlg::c_latticetransfdlg (cwnd* pparent/*=null*/): CDialogEx (Idd_transformdlg, pparent), M_tx (0), M_ty (0), M_tz (0), M_rx (0), M_ry (0), M_rz (0), Iscomplete (false){ /*mylatticepos = Thelatticepos;*/}//= = Other source filesvoidCmylattice::test5 () {C_latticetransfdlg*Latticetransfdlg; Latticetransfdlg=NewC_latticetransfdlg ();//= = Do not need this pointerLatticetransfdlg->DoModal (); //latticetransfdlg->create (C_latticetransfdlg::idd, NULL); //Latticetransfdlg->showwindow (sw_show); //myaiscontext->updatecurrentviewer (); floattx = Latticetransfdlg->Tx; floatRx = latticetransfdlg->Rx;}
MFC dialog box cross-file invocation