如何在SDI程序主框架的子视图中修改MainFrame的状态条文字。
我使用如下代码:
void CViewOne::ChangeStatusBarText()
{
CStatusBar *pBar = NULL;
pBar = (CStatusBar *)(AfxGetMainWnd()->GetDescendantWindow (AFX_IDW_TOOLBAR,TRUE));
int index = pBar->CommandToIndex(ID_INDICATOR_TEXT);
//ID_INDICATOR_TEXT是状态条中使用的一个资源项
pBar->SetPaneText(index,"New Text");
}
但是出错,是什么原因啊?