|
发表于 2020-9-4 20:15:01
|
显示全部楼层
#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;
///////////////////////////////////////////////////////////
请大侠帮忙,用SPY++看时,有消息产生,但没有运行显示相应的对话框? |
|