Lets say i have an edit control in my program. When i run the program i can write some text in it. How can i save/convert the text that was written in the control to a CString variable ?(it should be "saved" by clicking on a button)
1) Use ClassWizard to give the edit control a variable name. Menu View --> Class Wizzard, elect the control id then Add Variable. For an edit control that will create a CString object which will be filled when UpdateData(TRUE) is called.
2) Get the CWnd* pointer to the control. GetWindowText() returns CString. In below IDC_EDIT1 is the id number of the edit control and yous might be different. Check resource.h for the correct control id or you can view it in ClassWizzard.
Yes I made an error in my code. MSDN is the official source for help on all win32 api functions. Here's the link for GetWindowText(). You should always check MSDN before using win32 api and MFC functions/classes.