CTabCtrl的问题:获取TAB 的ITEM的LPARAM时导致CRASH,郁闷了很久没有答案,高分求解!
CTabCtrl:
添加TAB:
............................
CString title = "TAB1";
CString lparamText = .......
TC_ITEM tItem;
tItem.mask = TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE;
tItem.pszText = (LPSTR)title.GetBuffer();
title.ReleaseBuffer();
tItem.lParam = reinterpret_cast<DWORD>(new CString(lparamText));
tItem.cchTextMax = strlen(tItem.pszText);
mTab.InsertItem(0,&tItem);
.........................
获取TAB 的ITEM的LPARAM:
....................
CString *pString = reinterpret_cast<CString*>(tItem.lparam);
CString g = pString->GetBuffer(); //在RELEASE下这一行导致CRASH ,
pString->ReleaseBuffer();
return g;