Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 16: Text-Based Controls Visual C++ and MFC Fundamentals


btnCancel->SetWindowPos(NULL, RectApply.left, RectApply.top, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
// Put the OK button where the Cancel button was
btnOK->SetWindowPos(NULL, RectCancel.left, RectCancel.top, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);

return bResult;
}


  1. We will enable the Apply button when any control on the property pages changes
    value.
    Display the IDD_QUADRILATERAL dialog box and double-click the Side edit
    control. If you are using MSVC 6, accept the suggest Member Function Name and
    click OK. Implement the event as follows:


void CQuadrilateral::OnEnChangeEdtSside()
{
// TODO: Add your control notification handler code here
SetModified();
}


  1. Display the IDD_G3D dialog box and double-click the Side edit box. If you are
    using MSVC 6, accept the suggest Member Function Name and click OK


void CGeome3D:: OnEnChangeEdtUside()
{
// TODO: Add your control notification handler code here
SetModified();
}


  1. Test the application and return to MSVC

  2. Using either MFC AppWizard (exe)(MSVC 6) or MFC Application (MSVC 7),
    create a new application named Associates

  3. Create it as a Single Document without Printing And Print Preview

  4. Change the design of the IDR_MAINFRAME as follows:

  5. Access the CMainFrame::PreCreateWindow() event and, to remove the Untitled
    word from the title bar, type the following:


BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
Free download pdf