C++ MFC MDI how to change what class view displays based on active document -
i'm working on mdi application has object browser (cclassview) has change displays based on "document" active.
ps: none of searches have worked.
this isn't expected, here's possible solution:
q: how active document anywhere in application?
a: there several methods, 1 first active frame call cframewnd::getactivedocument. ... in mdi applications, have additionally active mdi child frame.
cdocument* getmdiactivedocument() { cdocument* pdoc = null; cwnd* pwndmain = afxgetmainwnd(); assert(pwndmain); assert(pwndmain->iskindof(runtime_class(cmdiframewnd))); // not mdi app. cframewnd* pframe = ((cmdiframewnd*)pwndmain)->mdigetactive(); if(null != pframe) { pdoc = pframe->getactivedocument(); // active document } return pdoc; }
this sample code might suggest other (perhaps better) alternatives:
http://msdn.microsoft.com/en-us/library/cstcs513%28v=vs.90%29.aspx
Comments
Post a Comment