Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 5: The Document/View Architecture Visual C++ and MFC Fundamentals


ON_WM_CREATE()
ON_WM_SHOWWINDOW()
END_MESSAGE_MAP()

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// Call the base class to create the window
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}

void CMainFrame::OnShowWindow(BOOL bShow, UINT nStatus)
{
CFrameWnd::OnShowWindow(bShow, nStatus);

// TODO: Add your message handler code here
ShowWindow(SW_MAXIMIZE);
}

BOOL CExerciseApp::InitInstance()
{
m_pMainWnd = new CMainFrame ;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

return TRUE;
}

CExerciseApp theApp;


  1. Test the program and return to MSVC


4.2.3 Window Activation.............................................................................


WM_ACTIVATE: When two or more windows are running on the computer, only one
can receive input from the user, that is, only one can actually be directly used at one
particular time. Such a window has a title bar with the color identified in Control Panel as
Active Window. The other window(s), if any, display(s) its/their title bar with a color
called Inactive Window:
Free download pdf