Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Handles to View Classes :: MFC

Handles to View Classes :: MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    valikac
    wrote on last edited by
    #1

    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

    C R V 3 Replies Last reply
    0
    • V valikac

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • V valikac

        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

        R Offline
        R Offline
        Roman Fadeyev
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • V valikac

          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

          V Offline
          V Offline
          valikac
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups