Q: How to set/get the values of various controls?
A: Use the class wizard (CTRL+W) to create member variables for your controls. For each control you can create two variables: one of the type "Value" and one of the type "Control". Use the "Value" type variable to set or get the value of the control. Use the "Control" type variable to access the control.
Avoid using 'GetDlgItem()' for several reasons. 'GetDlgItem()' returns a 'CWnd*' that need to be casted to the correct class. Subtle bugs can arise from wrong casting (e.g. if a 'CListCtrl' is casted to a 'CListBox' by mistake). These bugs are very hard to find, because they do not trigger a runtime error in the most cases - the control simply "refuses" to do what it is told to.
Besides of that, repeatedly calling 'GetDlgItem()' is slower than having your controls member variables of their container.
For further information take a look at this article...