标签:des style io os ar 使用 sp on bs
API(Application Programming Interface):开放给应用程序调用的系统功能。long FAR PASCAL WndProc(HWND hWnd, UINT msg, WORD wParam, LONG lParam) { switch(msg) { case WM_COMMAND : swtich(wParam) { case IDM_ABOUT : OnAbout(hWnd, wParam, lParam); break; } break; case WM_PAINT : OnPaint(hWnd, wParam, lParam); break; default : DefWindowProc(hWnd, msg, wParam, lParam); } }
class CMyFrameWnd : public CFrameWnd { public : CMyFrameWnd(); afx_msg void OnPaint(); afx_msg void OnAbout(); DECLARE_MESSAGE_MAP() }
/***********************************************************/ /* WINMAIN.CPP */ /***********************************************************/ /* int AFXAPI AfxWinMain (...) */ /* { */ /* CWinApp* pApp = AfxGetApp(); */ /* */ /* AfxWinInit(...); */ /* */ /* pApp->InitApplication(); */ /* pApp->InitInstance(); */ /* nReturnCode = pApp->Run(); */ /* */ /* AfxWinTerm(); */ /* } */ /***********************************************************/ /* HELLO.CPP */ /***********************************************************/ /* CMyWinApp theApp; //application object */ /* */ /* BOOL CMyWinApp::initInstance() */ /* { */ /* m_pMainWnd = new CMyFrameWnd(); */ /* m_pMainWnd->ShowWindow(m_nCmdShow); */ /* m_pMainWnd->UpdateWindow(); */ /* return TRUE; */ /* } */ /* */ /* CMyFrameWnd::CMyFrameWnd() */ /* { */ /* Create(NULL, "Hello MFC", ..., "MainMenu"); */ /* } */ /* */ /* void CMyFrameWnd::OnPaint() {...} */ /* void CMyFrameWnd::OnAbout() {...} */ /* */ /* BEGIN_MESSAGE_MAP(CMyFrameWnd, CFrameWnd) */ /* ON_COMMAND(IDM_ABOUT, OnAbout) */ /* ON_WM_PAINT() */ /* END_MESSAGE_MAP() */ /***********************************************************/
|-----------------------------------------------------------------------------| | 宏名称 | 对应消息 | 消息处理函数(名称已由系统默认) | |-------------------|-------------------|-------------------------------------| | ON_WM_CHAR | WM_CHAR | OnChar | |-------------------|-------------------|-------------------------------------| | ON_WM_CLOSE | WM_CLOSE | OnClose | |-------------------|-------------------|-------------------------------------| | ON_WM_CREATE | WM_CREATE | OnCreate | |-------------------|-------------------|-------------------------------------| | ON_WM_DESTROY | WM_DESTROY | OnDestroy | |-------------------|-------------------|-------------------------------------| | ON_WM_LBUTTONDOWN | WM_LBUTTONDOWN | OnLButtonDown | |-------------------|-------------------|-------------------------------------| | ON_WM_LBUTTONUP | WM_LBUTTONUP | OnLButtonUp | |-------------------|-------------------|-------------------------------------| | ON_WM_MOUSEMOVE | WM_MOUSEMOVE | OnMouseMove | |-------------------|-------------------|-------------------------------------| | ON_WM_PAINT | WM_PAINT | OnPaint | |-----------------------------------------------------------------------------|
|-----------------------------------------------------------| | 控件 | 宏名称 |消息处理函数| |----------|-----------------------------------|------------| | Button | ON_BN_CLICKED(<id>,<memberFxn>) | memberFxn | |----------|-----------------------------------|------------| | ComboBox | ON_CBN_DBLCLK(<id>,<memberFxn>) | memberFxn | |----------|-----------------------------------|------------| | Edit | ON_EN_SETFOCUS(<id>,<memberFxn>) | memberFxn | |----------|-----------------------------------|------------| | ListBox | ON_LBN_DBLCLK(<id>,<memberFxn>) | memberFxn | |-----------------------------------------------------------|
标签:des style io os ar 使用 sp on bs
原文地址:http://blog.csdn.net/lasolmi/article/details/40680077