6/19/2017

tip, CString token in MFC

refer to below code.


CString selectedModel;
m_ListBoxOfConnection.GetText(sel, selectedModel);
//selectedModel = "com1,model1,base";

CString comStr;
CString modelStr;
CString optionStr;

AfxExtractSubString(comStr, selectedModel, 0, ',');
AfxExtractSubString(modelStr, selectedModel, 1, ',');
AfxExtractSubString(optionStr, selectedModel, 2, ',');


//then
//comStr = com1
//modelStr = model1
//optionStr = base


Thank you.



6/18/2017

small tip, mfc listbox all delete

ListBox.ResetContent();

^^

tip, CString to int, MFC

CString str; 
int integer; 

integer = _wtoi(str); // wide charater formats 
integer = _atoi(str); // otherwise


Thank you~!!