I'm trying to convert a variables entered in as a CEdit to a CString, doing some standard error checking, then later to a string to pass to another api. Does anyone know the functions to do this?
Printable View
I'm trying to convert a variables entered in as a CEdit to a CString, doing some standard error checking, then later to a string to pass to another api. Does anyone know the functions to do this?
Have you tried MSDN? Looks like the GetLine member might help, but it doesn't take a CString. You might have to allocate a regular character buffer and construct a CString off that...
(Disclaimer: Never used MFC. ;) )
I'm trying to basically just get the input down to a string to throw into a networking api.
I know how to convert a CString to a String:
but this CEdit box is killing me.Code:CString cs("Hello");
std::string s((LPCTSTR)cs);
Wow that was stupid I totally missed the question...
Yeah you use GetDlgItemText( CString, Control ID )
Sorry that was a totally unhelpful answer before...
GetDlgItemText() takes a CString.
GetDlgItemText(IDC_SOME_EDIT,String);
or
CEdit SomeEdit;
CString String;
SomeEdit.GetWindowText(String);