Posted on 2004-11-21
Last Modified: 2013-11-20
I want to get a pointer to the CMainFrame, the code is like this:

CMainFrame* pFrame = (CMainFrame*)AfxGetMainFrame();

but it is giving error that is:
AfxGetMainFrame' : undeclared identifier

Can anybody help?
Question by:jhapak
    LVL 55

    Accepted Solution

    Correct function is AfxGetMainWnd():

    CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();

    It returns the m_pMainWnd member of the current CWinApp object.

    Have a look to:
    LVL 1

    Author Comment

    you got the points

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Folder Comparison 12 50
    ODBC Connection Logging, ADO.NET 6 44
    pre4 challenge 19 75
    post4 challenge 28 72
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now