Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 2 Variables and Identifiers Visual C++ and MFC Fundamentals


// Use a pointer to the window's frame for the application
// to use the window
CSimpleFrame *Tester = new CSimpleFrame ();
m_pMainWnd = Tester;

// Show the window
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

return TRUE;
}

CSimpleApp theApp;

Figure 24: Windows Application.................................................................................................



  1. Test the program

  2. To close the window, click its system Close button and return to MSVC

  3. To provide a checking process with the CObject::AssertValid() method and to
    diagnosis services using the CObject::Dump() method, change the file as follows:


#include <afx.h>
#include <afxwin.h>

class CSimpleFrame : public CFrameWnd
{
public:
CSimpleFrame();

#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};

struct CSimpleApp : public CWinApp
Free download pdf