2009-09-02 5 views
0

MFC 기반 Windows 응용 프로그램 (Visual C++)을 디버깅 한 후 다음 경고가 표시됩니다. 문제는 창을 표시하지 않는다는 것입니다. 왜 그래야만하지?Visual C++를 사용하는 MFC 프로그램

Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application. 
The program '[2616] new.exe: Native' has exited with code 0 (0x0).

코드는 다음과 같습니다

#include <afxwin.h> 
#include "stdafx.h" 

class myframe:public CFrameWnd 
{ 
public: 
myframe() 
{ 
    Create(0,TEXT("On single Left Mouse Button Click")); 
} 
void OnLButtonDown(UINT flag,CPoint pt) 
{ 
    CClientDC d(this); 
    d.SetTextColor(RGB(0,0,255)); 
    d.TextOutW(pt.x,pt.y,TEXT("Hello"),5); 
} 
DECLARE_MESSAGE_MAP() 
}; 

BEGIN_MESSAGE_MAP(myframe,CFrameWnd) 
ON_WM_LBUTTONDOWN() 
END_MESSAGE_MAP() 

class myapp:public CWinApp 
{ 
public: 
    int InitInsatnce() 
    { 
     myframe *p; 
     p=new myframe; 
     p->ShowWindow(3); 
     m_pMainWnd=p; 
     return 1; 
    } 
}; 
myapp a; 
+0

첫 번째 : myframe() 둘째, myframe 용 코드를 볼 수 있습니까? –

+0

Oh boy 내가 힘을 편집하고 싶다면 ... –

+2

은 "InitInsatnce"오타가 아닙니까? 실제 코드에이 코드가 있습니까? – djeidot

답변

4

는 오타 수정 : InitInsatnceInitInstance이 다음 화면이 초기화되어 표시됩니다해야합니다.

관련 문제