Get pointer of CView of a CDocument-Object
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Get pointer of CView of a CDocument-Object

  1. #1
    Join Date
    Jul 2001
    Posts
    293

    Get pointer of CView of a CDocument-Object

    Hello,

    I want to get a pointer of one CView of my CDocument-Object.
    It does not matter what view.

    Has every CDocument at least one CView ? (MDI-app !)
    Can I presum that
    GetNextView(GetFirstViewPosition()) returns a valid CView-Object ?

    Ralf

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,413

    Re: Get pointer of CView of a CDocument-Object

    Have a look at MSDN: CDocument::GetNextView
    BTW, why do you need "to get a pointer of one CView of ... CDocument-Object"?
    Victor Nijegorodov

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,106

    Re: Get pointer of CView of a CDocument-Object

    Documents don't necessarily have views.

  4. #4
    Join Date
    Jul 2001
    Posts
    293

    Re: Get pointer of CView of a CDocument-Object

    Quote Originally Posted by VictorN View Post
    Have a look at MSDN: CDocument::GetNextView
    BTW, why do you need "to get a pointer of one CView of ... CDocument-Object"?
    Hello Victor,

    it is a little bit complicated to explain.
    I need it do call OnDraw directly.
    I think, it is not usual to do it, but it is necessary.

    Ralf

  5. #5
    Join Date
    Jul 2001
    Posts
    293

    Re: Get pointer of CView of a CDocument-Object

    Quote Originally Posted by GCDEF View Post
    Documents don't necessarily have views.
    in what case there is no CView for an every CDodument in a MDI-app ?

  6. #6
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,413

    Re: Get pointer of CView of a CDocument-Object

    Quote Originally Posted by Ralf Schneider View Post
    Hello Victor,

    it is a little bit complicated to explain.
    I need it do call OnDraw directly.
    I think, it is not usual to do it, but it is necessary.

    Ralf
    You should (must!) not do it!
    Instead you should call Invalidate (or InvalidateRect) for the view you want to draw/redraw something
    Victor Nijegorodov

  7. #7
    Join Date
    Jul 2001
    Posts
    293

    Re: Get pointer of CView of a CDocument-Object

    Quote Originally Posted by VictorN View Post
    You should (must!) not do it!
    Instead you should call Invalidate (or InvalidateRect) for the view you want to draw/redraw something
    I do not want to render it on the screen.
    I want to create a Metafile !
    I call OnDraw with the DeviceContext of the metafile.

  8. #8
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,106

    Re: Get pointer of CView of a CDocument-Object

    Quote Originally Posted by Ralf Schneider View Post
    in what case there is no CView for an every CDodument in a MDI-app ?
    Code:
    CMyDocument myDocument;
    There should be a view if it's created by the framework. I'm with Victor though. I don't see why you'd need the view from the document. That sounds like a design problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center