IDS_Status
IDS_TimeCost
IDS_ItemsScanned
2,修改 MainFrm.cpp 中的 indicators 定義:
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
IDS_Status,
IDS_TimeCost,
IDS_ItemsScanned,
// ID_INDICATOR_CAPS,
// ID_INDICATOR_NUM,
// ID_INDICATOR_SCRL,
};
3,在 CMainFrame::OnCreate() 中創建代碼之後添加設置代碼:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// 設置狀態欄的信息顯示位置
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(IDS_Status), IDS_Status, SBPS_NORMAL, 100);
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(IDS_TimeCost), IDS_TimeCost, SBPS_NORMAL, 150);
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(IDS_ItemsScanned), IDS_ItemsScanned, SBPS_NORMAL, 150);
return 0;
}
4,在消息處理函數中修改顯示的值串:
LRESULT CMainFrame::OnMSGGotFileStatus(WPARAM wParam, LPARAM lParam)
{
CSD_FileScannerView* pView = (CSD_FileScannerView*)GetActiveVIEw();
pVIEw->OnMSGGotFileStatus(wParam, lParam);
CFileStatus fileStatus(*(CFileStatus*)lParam);
m_wndStatusBar.SetPaneText(0, fileStatus.m_szFullName);
CString str;
str.Format(_T("Time Cost: %u.%03d Sec")
, (GetTickCount() - m_dwStartTick)/1000
, (GetTickCount() - m_dwStartTick)%1000
);
int iIndex = m_wndStatusBar.CommandToIndex(IDS_TimeCost);
m_wndStatusBar.SetPaneText(iIndex, str);
return 0;
}