CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2000
    Location
    canada
    Posts
    60

    Question Problem with GetFirstDocTemplatePosition function

    Hi,

    i'm developing a MDI application with two CMultiDocTemplate. In the View class of one of them, i want to access one of these CMultidocTemplate using this command:

    CEVPlayerApp* pMain = (CEVPlayerApp*)AfxGetApp()->m_pMainWnd;

    POSITION posTemplate = (POSITION)pMain->GetFirstDocTemplatePosition();

    But when i run it, i've a dialog box saying that the memory canno't be read, even if i doesn't have compilation error.

    Does anybody have an idea about it ?

    Thanks in advance.

    Your response will be rated.

  2. #2
    Join Date
    Oct 2000
    Location
    India
    Posts
    489
    Well how abt using
    AfxGetApp()->GetFirstDocTemplatePosition() ??

    Since it is a member fn of CWinApp.

  3. #3
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    Remove "->m_pMainWnd" and it should work. You were trying to get the main window and cast it ta an application object. That's why it chrashes.
    regards,
    MiMec

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