1在头文件里面添加下面定义
CStatusBar m_status;
2 在OnInitDialog()里面添加下面的代码
m_status.Create(this);
UINT nID[] = {10000,10001};
m_status.SetIndicators(nID,2);
m_status.SetPaneInfo(0,10000,SBPS_NORMAL, 100);
m_status.SetPaneInfo(1,10001,SBPS_STRETCH,0);
RECT rect = {0};
GetClientRect(&rect);
m_status.MoveWindow(0,rect.bottom-20,rect.right,20,true);
3 文本框的Change事件
void CDemoDlg::OnEnChangeEdtInput()
{
// TODO: 在此添加控件通知处理程序代码
int nLen = m_edt_input.GetWindowTextLength();
CString str;
str.Format(_T("字数: %d"),nLen);
m_status.SetPaneText(1,str,TRUE);
}