|
#include<afxwin.h> //MFC code and standard components
class CMinApp:public CWinApp
{public: virtual BOOL InitInstance();};
class CMainWnd:public CFrameWnd
{protected:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
public: DECLARE_MESSAGE_MAP();
};
BEGIN_MESSAGE_MAP(CMainWnd, CFrameWnd)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
END_MESSAGE_MAP()
void CMainWnd::OnLButtonDown(UINT nFlags, CPoint point)
{CString szAboutLeft="This is a minimal WIndows MFC program.\n"
"You've pressed the left mouse button!";
::MessageBeep(MB_ICONINFORMATION);
::MessageBox(GetSafeHwnd(),szAboutLeft,"About",MB_OK|MB_ICONINFORMATION);
CFrameWnd::OnLButtonDown(nFlags,point);
}
void CMainWnd::OnRButtonDown(UINT nFlags, CPoint point)
{CString szAboutRight="This is a minimal Windows MFC program.\n"
"You've pressed the right mouse button!";
::MessageBeep(MB_ICONINFORMATION);
::MessageBox(GetSafeHwnd(),szAboutRight,"About",
MB_OK|MB_ICONINFORMATION);
CFrameWnd::OnRButtonDown(nFlags,point);
}
BOOL CMinApp::InitInstance()
{CFrameWnd* pFrame=new CFrameWnd;
pFrame->Create(0,_T("Another Minimal MFC Program"));
pFrame->ShowWindow(SW_SHOWMAXIMIZED);
pFrame->UpdateWindow();
AfxGetApp()->m_pMainWnd=pFrame;
return TRUE;
}
CMinApp MyApp;
///////////////////////////////////////////////// /////////
Please help me. When I use SPY++ to watch, a message is generated, but the corresponding dialog box is not displayed? |
|