c++ - MFC can't find GetDocument() in a Dialog -
i'm new mfc,and want data in dialog,but doesn't work,
ctestdoc* pdoc=getdocument(); pdoc->get(...);
i google , find getdocument() used in cview. try , works:
cmainframe *pmain=(cmainframe *)afxgetapp()->m_pmainwnd; ctestview *pview=(ctestview *)pmain->getactiveview(); m_name=pview->v_name;
but don't think it's solution,so want know there functions solve this?thank you.
you didn't dialog may desirable pass data dialog, , not have dialog access document data directly. helps keep dialog more isolated , more usable in other programs.
i @ command dialog displayed. in view? if so, can pass document data needed dialog. if not, code posted may still make sense. either way, that's should locate desired document information, , pass dialog.
i avoid making dialog directly aware of document if it's not necessary.
Comments
Post a Comment