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. how to get cview or cdocment object pointer?

how to get cview or cdocment object pointer?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
3 Posts 2 Posters 0 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.
  • D Offline
    D Offline
    derek7
    wrote on last edited by
    #1

    in MFC, I know doc and view is created in ProcessShellCommand with CSingleDocTemplate. but I wanna get current view pointer so that I can hide it by ShowWindow(getView(), SW_HIDE);

    H 1 Reply Last reply
    0
    • D derek7

      in MFC, I know doc and view is created in ProcessShellCommand with CSingleDocTemplate. but I wanna get current view pointer so that I can hide it by ShowWindow(getView(), SW_HIDE);

      H Offline
      H Offline
      Hardy_Smith
      wrote on last edited by
      #2

      First, pos = AfxGetApp()->GetFirstDocTemplatePosition(); ASSERT(pos); pTemplate=AfxGetApp()->GetNextDocTemplate(pos); POSITION docpos=pTemplate->GetFirstDocPosition( ); get the first DocTemplate. Then you can enumerate your views. CDocument *pDocument=NULL; while (docpos) { pDocument = pTemplate->GetNextDoc(docpos); ASSERT(pDocument); POSITION viewpos = pDocument->GetFirstViewPosition(); while (viewpos != NULL) { ... } } Hope this helps, Hardy.

      D 1 Reply Last reply
      0
      • H Hardy_Smith

        First, pos = AfxGetApp()->GetFirstDocTemplatePosition(); ASSERT(pos); pTemplate=AfxGetApp()->GetNextDocTemplate(pos); POSITION docpos=pTemplate->GetFirstDocPosition( ); get the first DocTemplate. Then you can enumerate your views. CDocument *pDocument=NULL; while (docpos) { pDocument = pTemplate->GetNextDoc(docpos); ASSERT(pDocument); POSITION viewpos = pDocument->GetFirstViewPosition(); while (viewpos != NULL) { ... } } Hope this helps, Hardy.

        D Offline
        D Offline
        derek7
        wrote on last edited by
        #3

        POSITION pos = GetFirstViewPosition(); while (pos != NULL) { CView* pView = GetNextView(pos); pView->UpdateWindow(); } if GetFirstViewPosition return a first pos.then GetNextView will return second pos view pointer. Am I right?

        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