c的入口是main()
Win32 Application的入口是winmain()
请问MFC的入口是什么?

解决方案 »

  1.   

    winmain(),不过被藏起来了,看不到。
      

  2.   

    MFC不过是一些类的集合,它不存在什么入口。应该说用MFC编写的Win32应用程序的入口是WinMain(......)才对。
      

  3.   

    /////////////////////////////////////////////////////////////////////////////
    // Standard WinMain implementation
    //  Can be replaced as long as 'AfxWinInit' is called firstint AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPTSTR lpCmdLine, int nCmdShow)
    {
    ASSERT(hPrevInstance == NULL); int nReturnCode = -1;
    CWinThread* pThread = AfxGetThread();
    CWinApp* pApp = AfxGetApp(); //通过全局函数获取你的程序指针,然后
                                           //通过虚拟函数进行调用InitInstance
     
    // AFX internal initialization
    if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
    goto InitFailure; // App global initializations (rare)
    if (pApp != NULL && !pApp->InitApplication())
    goto InitFailure; // Perform specific initializations
    if (!pThread->InitInstance())
    {
    if (pThread->m_pMainWnd != NULL)
    {
    TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
    pThread->m_pMainWnd->DestroyWindow();
    }
    nReturnCode = pThread->ExitInstance();
    goto InitFailure;
    }
    nReturnCode = pThread->Run();InitFailure:
    #ifdef _DEBUG
    // Check for missing AfxLockTempMap calls
    if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
    {
    TRACE1("Warning: Temp map lock count non-zero (%ld).\n",
    AfxGetModuleThreadState()->m_nTempMapLock);
    }
    AfxLockTempMaps();
    AfxUnlockTempMaps(-1);
    #endif AfxWinTerm();
    return nReturnCode;
    }
    在winmain.cpp里面
      

  4.   

    基本同意 codelover(蜡笔小钦),不过C++语言先构造全局变量(theApp)应该先从他的构造函数开始。在你的程序中一般先从InitInstance(),InitDialog()函数中作一些初始动作。
      

  5.   

    codelover(蜡笔小钦) 基本正确
      

  6.   

    extern "C" int WINAPI
    _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPTSTR lpCmdLine, int nCmdShow)
    {
    // call shared/exported WinMain
    return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
    }
      

  7.   

    codelover(蜡笔小钦)的分析不免有“用复杂问题去解决复杂问题”之嫌,应该用Win32应用程序去分析MFC应用程序,而不能用MFC应用程序自身去解剖它自己。
      

  8.   

    mfc不过是winapi被用c++类封装起来了。实质还是win32,所以就是winmain是入口。