CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Posts
    13

    How to get the MainFrame object in Document

    hai,
    I want to use the MainFrame object in Document class with out using the (new operator). Please help me to solve this problem.
    Thanks in advance.
    sundar

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: How to get the MainFrame object in Document

    See AfxGetMainWnd().
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Jul 2009
    Posts
    13

    Re: How to get the MainFrame object in Document

    hai,
    The AfxGetMainWnd() function returns the CWnd object..How i can match this to get the MainFrame object.please tell the procedure to get the object.
    Thanks in advance.
    sundar

  4. #4
    Join Date
    Oct 2001
    Location
    Dublin, Eire
    Posts
    880

    Re: How to get the MainFrame object in Document

    Code:
    CMainFrame* pFrame = static_cast<CMainFrame*>(AfxGetMainWnd());
    Elrond
    A chess genius is a human being who focuses vast, little-understood mental gifts and labors on an ultimately trivial human enterprise.
    -- George Steiner

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured