Handles to View Classes :: MFC
-
Hi. I want to send messages to one or more view classes from either CMainFrame or the doc class. I would like to know, How do you get access to the handles of one or more view classes from inside the doc class and/or CMainFrame? Thanks, Kuphryn
AfxGetMainWnd()->GetActiveView(), from memory. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
-
Hi. I want to send messages to one or more view classes from either CMainFrame or the doc class. I would like to know, How do you get access to the handles of one or more view classes from inside the doc class and/or CMainFrame? Thanks, Kuphryn
If you mean sending to some views belonging to the same document, the way is to use
POSITION pos = GetFirstViewPosition();
while (pos != NULL) {
CView* pView = GetNextView(pos);
...
}For some documents use CDocTemplate::GetFirstDocPosition/GetNextDoc and then - the code above To enumerate all views of all documents of all types you can use CDocManager::GetFirstDocTemplatePosition/GetNextDocTemplate, then see above How to get instance of docmanager see CWinApp documentation. If my memory doesn't fail me, CWinApp have a member m_pDocManager
-
Hi. I want to send messages to one or more view classes from either CMainFrame or the doc class. I would like to know, How do you get access to the handles of one or more view classes from inside the doc class and/or CMainFrame? Thanks, Kuphryn
Thanks everyone. http://www.codeguru.com/forum/showthread.php?s=&postid=641316#post641316 Andreas Masur of CodeGuru posted a valuable chart on getting access to difference classes in MFC. http://www.codeguru.com/forum/showthread.php?s=&postid=641316#post641316 Kuphryn