CPropertySheet/CTabCtrl GetItem(...) with TCIF_PARAM = errors
Hi,
I have a fairly straightforward subclassed CProperpySheet and I am doing
some small work with the TabControl.
So in my Inidialog I subclass the tab control.
BOOL CMySheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
m_tabCtrl.SubclassDlgItem(
CPropertySheet::GetTabControl()->GetDlgCtrlID(), this );
return bResult;
}
Then in my tab control, when the user clicks on a tab I do...
{
....
TCHAR sSrcBuffer[256] = {0};
TCITEM tcitem;
tcitem.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_PARAM | TCIF_STATE;
tcitem.pszText = sSrcBuffer;
tcitem.cchTextMax = _countof(sSrcBuffer);
BOOL bOK = GetItem(nSrcTab,&tcitem);
assert(bOK);
....
}
I do nothing to the control before and after.
I then get an error when I exit the function, (in the destructor of the
local variables).
"Run- Time check failure #2 - Stack around the variable 'xxx' was corrupted"
When I change the Mask to
tcitem.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_STATE;
Everything works fine
What could be the problem? I am using VS2008.
Many thanks
Simon