Article From:https://www.cnblogs.com/mengmeng90/p/9124909.html

1. The type of variable is different:
control A variable is an instance (object) of the class in which the control belongs, controlling variables of the object. That is, the variable represents the object itself. On behalf of this man!
value It is used to transfer data, and can not perform other operations on controls. Transfer data to a variable. On behalf of the man said!

Two. Use examples:
1、Adding the control variable of m_CtrlEdit can invoke all functions supported by the control, such as:
CString str_name;
m_CtrlEdit.GetWindowText(str_name);
You can use the function of the object to get the text.
2、The value variable added to m_CtrlEdit is used to pass data to the control, such as:
CString m_Str
m_Str = “hustwjz”;

The main difference is the difference between variables and controls. For example, the two variables of Edit are essentially the same.
When defined as a control variable, the object representing the control is the control itself. It has all member functions and member variables of this control.
It is defined as Value type variable MFC, which controls the content of a control to a variable, mainly reading and writing the contents in Edit.
However, by acquiring objects of control type, you can also read and write the contents on this object, but it is not convenient.
It’s just like letting someone else come to his book and go straight to get his book.

Similar Posts:

Link of this Article: Value and Control in MFC

Leave a Reply

Your email address will not be published. Required fields are marked *