My first win32 application program

#include<afxwin.h>
#include<afx.h>
#define _AFXDLL
class CHelloApp :public CWinApp
{
public:
 virtual BOOL InitInstance();
};
CHelloApp theApp;
class CMainFrame :public CFrameWnd//主窗口类
{
public:
 CMainFrame() {
  Create(NULL, _T("Hello World!"), WS_OVERLAPPEDWINDOW, CRect(0, 0, 400, 300));//
 }
protected:
 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CMainFrame,CFrameWnd)
 ON_WM_LBUTTONDOWN()
 END_MESSAGE_MAP()
void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point)
{
 MessageBox(_T("welcome to learn visual c++!"),_T( "hello"));
 CFrameWnd::OnLButtonDown(nFlags, point);
}
BOOL CHelloApp::InitInstance()
{
 m_pMainWnd = new CMainFrame();
 m_pMainWnd->ShowWindow(m_nCmdShow);
 m_pMainWnd->UpdateWindow();
 return TRUE;
}

经历了如下error:http://www.vcerror.com/?p=130

注意项目——>属性——>常规中 MFC 设置在动态dll中使用

My first win32 application program

上一篇:安装javaUbuntu下安装JDK1.6,并将之设为默认的JDK


下一篇:Centos 安装Tomcat