Home > Software engineering >  This class of functions, how to call this kind of control?
This class of functions, how to call this kind of control?

Time:09-24

Set up a dialog based application, the main dialog box for CMFCAppDlg, designed a button in the dialog box, through DLG. DoModal () the pop-up dialog box CMFCMEA, running a class function void in CMFCMEA CMyESAPIReceive: : OnMultiMeasurementAnswer (const MultiMeasResultT& The result), want to operate in the function in CMFCMEA controls, how to operate? With # define pMainWnd ((CMFCMEA *) AfxGetMainWnd ()); PMainWnd - & gt; The control line? Only main dialog box can be used?

CodePudding user response:

To control a pointer is passed to the class in the
Such as
ClassB
{
Public:
CEdit * m_pEdit;
ClassB () {m_pEdit=NULL; }
Public:
Void Fun ()
{
If (m_pEdit & amp; & M_pEdit - & gt; M_hWnd)
{
M_pEdit - & gt; SetWindowText (_T (" Test "));
}
}

};

ClassA
{
Void FunA ()
{
ClssB b (this);
B.m _pEdit=& amp; M_Edit;
B.D oModal ();
}
};

CodePudding user response:

It can be used, but the control will not receive the message

CodePudding user response:

Send a message to the main dialog, PostMessage, let the main dialog box operation
  • Related