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:

http://forums.codeguru.com/showthread.php?473808-mfc-doc-view-how-to-get-the-active-document-anywhere-in-my-application

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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -