1. After creating a single document project, add the display name to the string table member in the resource bar:
Ids_status
Ids_timecost
Ids_itemsscanned
2. Modify the indicators definition in mainfrm. cpp:
Static uint indicators [] =
{
Id_separator, // status line indicator
Ids_status,
Ids_timecost,
Ids_itemsscanned,
// Id_indicator_caps,
// Id_indicator_num,
// Id_indicator_scrl,
};
3. Create the code in cmainframe: oncreate () and add the setting code:
Int cmainframe: oncreate (maid)
{
...
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
}
// Set the information display position of the status bar
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. Modify the displayed value string in the message processing function:
Lresult cmainframe: onmsggotfilestatus (wparam, 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;
}