有个同学用VC++做了上机作业给老师检查时,被问到:
你不是声明了一个CMainFrame类吗?这个类定义的对象在哪呢?
能不能单步执行来看?

解决方案 »

  1.   

    在以下这个实例初始化函数中定义
    BOOL CDwsgglApp::InitInstance()
    {
    AfxEnableControlContainer(); // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.#ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));
    // To create the main window, this code creates a new frame window
    // object and then sets it as the application's main window object.//以下就是定义了一个CMainFrame对象的指针,其指向一个CMainFrame对象。 CMainFrame* pFrame = new CMainFrame;
    m_pMainWnd = pFrame; // create and load the frame with its resources pFrame->LoadFrame(IDR_MAINFRAME,
    WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
    NULL);
    HICON icon = LoadIcon(IDR_MAINFRAME); //调用图标
    pFrame->SetIcon(icon,true); //显示大图标
    pFrame->SetIcon(icon,false); //显示小图标 // The one and only window has been initialized, so show and update it.
    pFrame->ShowWindow(SW_SHOWMAXIMIZED);
    // pFrame->ShowWindow(SW_SHOW);
    pFrame->UpdateWindow(); return TRUE;
    }/////////////////////////////////////////////////////////////////////////////
    // CDwsgglApp message handlers
      

  2.   

    lingfeng8888(棱枫):同意
    Pipi0714(皮皮0714):反对可以,骂人不好
      

  3.   

    这个定义在你工程的WinApp的类中有
      

  4.   

    不但如此她还叫找出C...View类定义的对象。