Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 15: Fundamental Controls


application and you want to refer to it later on, you can declare a CStatic variable in the
header of its parent window. Here is an example:

class CExchangeDlg : public CDialog
{

...
public:
CStatic stcAdvanced;
};


The control variable is available for all controls.

It is a habit for Visual C++ programmers to start the name of a control variable with m_^

Practical Learning: Adding Control Variables



  1. Open MSVC again and open the Geometry application created above. If you do not
    have it, open the Geometry2 application that accompanies this book

  2. Open the IDD_QUADRILATERAL dialog box and adjust the locations and
    dimensions as you see fit or open the Geometry2 application that accompanies this
    book

  3. To declare a control variable, on the dialog box, right-click the edit box on the right
    side of Side and click Add Variable...

  4. In the Add Member Variable Wizard,
    in the Variable Type combo box, select CEdit
    in the Category combo box, select Control
    in the Variable Name edit box, type m_SquareSide

Free download pdf