Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 12: Dialog-Based Windows



  1. Click OK

  2. To prevent the floating window from being closed, in the Class View, click


CFloaterDlg to select it. In the Properties window, click the Messages button


  1. Click the arrow of the WM_CLOSE combo box and select the only item in the list

  2. When the user tries to close the window, we will hide it instead since the window
    will be closed when the parent application closes. Therefore, implement the event as
    follows:


void CFloaterDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
ShowWindow(FALSE);

CDialog::OnClose();
}


  1. Display the MainFrm.h header file and declare a CFloaterDlg variable named Floater


//
#pragma once
#include "FloaterDlg.h"

class CMainFrame : public CFrameWnd
{

protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)

// Attributes
public:
Free download pdf