/////////////////////////////////////////////////////////////// // // // mfcwin.cpp - small windows demo program // // // // Creates a movable, resizable window with title and // // system menu, but no contents, this time with the // // Microsoft Foundation Classes (MFC) // // // // Jim Fawcett, 27 July 1998, modified 15 Sep 1998 // // adapted for Visual C++, ver 6.0 from: // // MFC Internals, Shepard and Wingo, Addison-Wesley, 1996 // // // /////////////////////////////////////////////////////////////// #include //----< class implementing window >---------------------------- class CBasicWin : public CFrameWnd { public: CBasicWin() { Create(NULL, "CSE691 - Basic MFC Window"); } afx_msg void OnLButtonDown(UINT nFlags, CPoint point); DECLARE_MESSAGE_MAP() // note: no semicolon - this is a macro }; //----< message handler for left mouse button click >---------- void CBasicWin::OnLButtonDown(UINT nFlags, CPoint point) { MessageBox( "Left mouse button pressed", NULL, MB_OK); } //----< message map >------------------------------------------ BEGIN_MESSAGE_MAP(CBasicWin, CFrameWnd) ON_WM_LBUTTONDOWN() END_MESSAGE_MAP() // //----< class with message loop >------------------------------ class CBasicApp : public CWinApp { public: virtual BOOL InitInstance(); }; //----< create window and diplay it >--------------------------- BOOL CBasicApp::InitInstance() { m_pMainWnd = new CBasicWin(); m_pMainWnd -> ShowWindow(m_nCmdShow); m_pMainWnd -> UpdateWindow(); return TRUE; } //----< global applications object >--------------------------- CBasicApp basicApp;