Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

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


sprintf(MsgCoord, "Left = %d | Top = %d", x, y);

MessageBox(MsgCoord);
}

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

return TRUE;
}

CExerciseApp theApp;


  1. Test the application:

  2. Return to MSVC


4.2.7 Window Destruction...........................................................................


WM_DESTROY: Once the window has been used and the user has closed it, the
window must send a message to the operating system to destroy it. The message sent is
called ON_WN_DESTROY and its syntax is:

afx_msg void OnDestroy( );

This message takes no argument but you can use its body to do any last minute
assignment as needed. For example, you can use it either to prevent the window from
being closed or you can enquire whether the user really wants to close the window.

4.3 Command Messages....................................................................................

Free download pdf