Posts Tagged ‘CStatusBar’

Embedding progressbar in a statusbar!

Recently one user asked in a forum about how to embed a progress bar in a status bar! So basically what everybody should realize is that these are after all just windows! This means one window can go into another window, there is no limitation on this feature! Limitation is how you code and what are your requirements!

Is there a ready made function, yes there is as always with me! This is taken from my process viewer application…

void CProcessViewerDlg::SetUpProgressBar( CStatusBar* pStatusBar, CProgressBar* pPrgCtrl )
    // Validate parameter
    if( !pStatusBar||
        !pPrgCtrl ||
        !pStatusBar.GetSafeHwnd() ||
        !pPrgCtrl.GetSafeHwnd() )

    // Change parent of progress bar to status bar
    pPrgCtrl->SetParent( pStatusBar );

    // Set up progressbar in the first pane
    CRect crPaneRect;
    pStatusBar->GetStatusBarCtrl().GetRect( 1, &crPaneRect );

    // Adjust rectangle, deflate a bit
    crPaneRect.DeflateRect( 0, 2, 2, 2 );

    // Move progress rectangle into position, i.e. into first pane of statusbar
    pPrgCtrl->MoveWindow( crPaneRect );
}// End SetUpProgressBar

Increase statusbar height and width!

%d bloggers like this: