代码如下。主要功能是,创建了一个窗口,然后单击鼠标左键时弹出一个MessageBox
#include <afxwin.h>
class CMyApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMyWnd:public CFrameWnd
{
public:
CMyWnd();
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
};
#include "CreateTest.h"
CMyApp myapp;
BOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMyWnd();
m_pMainWnd->ShowWindow(SW_SHOWNORMAL);
m_pMainWnd->UpdateWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP(CMyWnd,CFrameWnd)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
CMyWnd::CMyWnd()
{
Create(NULL,_T("hhhh"));
}
void CMyWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
MessageBox(_T("My