关于对话框中创建状态栏的问题。
我用如下方式创建:
static UINT indicators[] =
{
ID_SEPARATOR, // 状态行指示器
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
m_wndStatusBar.Create(this);//,WS_BORDER|WS_VISIBLE|CBRS_BOTTOM
m_wndStatusBar.SetIndicators(indicators,sizeof(indicators)/sizeof(UINT));
我在创建状态栏后调用 this->SetPaneInfo(0,ID_INDICATOR_CAPS,SBPS_NORMAL ,firstW) 运行时出现崩溃,进出调试显示停在了下面红色的那句,请高手赐教。
void CStatusBar::SetPaneInfo(int nIndex, UINT nID, UINT nStyle, int cxWidth)
{
ASSERT_VALID(this);
BOOL bChanged = FALSE;
AFX_STATUSPANE* pSBP = _GetPanePtr(nIndex);
pSBP->nID = nID;
if (pSBP->nStyle != nStyle)
{
if ((pSBP->nStyle ^ nStyle) & SBPS_STRETCH)
bChanged = TRUE;
else
{
pSBP->nStyle = nStyle;
pSBP->nFlags |= SBPF_UPDATE;
SetPaneText(nIndex, pSBP->strText);
}
pSBP->nStyle = nStyle;
}
if (cxWidth != pSBP->cxText)
{
// change width of one pane -> invalidate the entire status bar
pSBP->cxText = cxWidth;
bChanged = TRUE;
}
if (bChanged)
UpdateAllPanes(TRUE, FALSE);
}
[解决办法]
你的 pSBP 有效么?
我资源有个动态建菜单的demo
[解决办法]
http://download.csdn.net/detail/xixiahouyi/1480251#comment
[解决办法]
http://www.cnblogs.com/joeblackzqq/archive/2010/12/21/1912548.html