Code to View/Hide Status Bar in SDI and MDI Applications Bourbonnais IL

Here's a little handler for the OnViewStatusBar message handler to change the "View/Hide Status Bar" menu option so that the application (main) window changes its height according to the size of the visible client area.

Local Companies

Universal Computer Systs
(630) 916-7113
Lombard, IL
J Cris Miller & Associates
(708) 579-9560
10555 74th St
Countryside, IL
Legacy Migration Solutions
(630) 717-1432
216 S Columbia St
Naperville, IL
Information Systems Group Inc
(847) 342-4885
3501 Algonquin Rd
Rolling Meadows, IL
Parcept Inc
(630) 428-9130
144 Tanoak Ln
Naperville, IL
Custom Computers & Web Masters
(630) 736-7600
966 W Army Trail Rd
Carol Stream, IL
Rdb Computing Inc
(847) 982-1910
8910 Kenton Ave
Skokie, IL
Bbdp Inc
(630) 963-2400
2001 Butterfield Rd
Downers Grove, IL
Amaitis and Associates Inc
(630) 595-8555
810 Lively Blvd
Wood Dale, IL
Integrated Store Systems Inc
(815) 758-1645
913 S 4th St
Dekalb, IL

provided by: 
Originally published at Internet.com


Ever wanted to change the "View/Hide Status Bar" menu option so that the application (main) window changes its height accordingly preserving the size of the visible client area?

Here's a little handler for the OnViewStatusBar message handler to perform this task. Versions for MFC or Non-MFC available. // // OnViewStatusBar handler // // increase or decrease app window height to adapt to // visible or invisible status bar // void CMainFrame::OnViewStatusBar() // MFC version // by Volker Bartheld { CControlBar* pBar = GetControlBar(AFX_IDW_STATUS_BAR); if (pBar != NULL) { RECT AppWinRect, BarRect; GetWindowRect(&AppWinRect); pBar->GetWindowRect(&BarRect); int iBarHeight = BarRect.bottom - BarRect.top; BOOL bShow = (pBar->GetStyle() & WS_VISIBLE) == 0; ShowControlBar(pBar, bShow, FALSE); if (bShow) { // ... increase frame SetWindowPos(&CWnd::wndNoTopMost, AppWinRect.top, AppWinRect.left, AppWinRect.right-AppWinRect.left, AppWinRect.bottom- AppWinRect.top+iBarHeight, SWP_NOMOVE); } else { // ... decrease frame SetWindowPos(&CWnd::wndNoTopMost, AppWinRect.top, AppWinRect.left, AppWinRect.right-AppWinRect.left, AppWinRect.bottom-AppWinRect.top- iBarHeight, SWP_NOMOVE); } } } void CMainFrame::OnViewStatusBar() // non-MFC-version // by Alexander Sailer { // MFC StatusbarHandler aufrufen OnBarCheck(ID_VIEW_STATUS_BAR); CControlBar* pBar = NULL; BOOL bVisible(false); RECT AppWinRect, BarRect; int iBarHeight(0); // get ptr to status bar pBar = GetControlBar(ID_VIEW_STATUS_BAR); ASSERT(pBar); // Abme_ungen holen GetWindowRect(&AppWinRect); pBar->GetWindowRect(&BarRect); iBarHeight = BarRect.bottom - BarRect.top; // Abfrage ob Bar sichtbar ist bVisible = pBar->IsVisible(); if (bVisible)// ... increase frame { SetWindowPos(&CWnd::wndNoTopMost, AppWinRect.top, AppWinRect.left, AppWinRect.right-AppWinRect.left, AppWinRect.bottom-AppWinRect.top+iBarHeight, SWP_NOMOVE); } else // ... decrease frame { SetWindowPos(&CWnd::wndNoTopMost, AppWinRect.top, AppWinRect.left, AppWinRect.right-AppWinRect.left, AppWinRect.bottom-AppWinRect.top-iBarHeight, SWP_NOMOVE); } }

Downloads

Download source - 1 Kb

Author: Volker Bartheld

Read article at Internet.com site

Featured Local Company

POGEE Systems & Technologies

(708) 267-7635
10448 S. Pulaski Road
Oak Lawn, IL

Related Local Events
BIO - International Convention and Exhibition for Biotechnology
Dates: 5/2/2010 - 5/5/2010
Location: McCormick Place
Chicago, IL
View Details

SuperComm
Dates: 10/21/2009 - 10/23/2009
Location: McCormick Place, Chicago
Chicago, IL
View Details

WiMAX World Americas
Dates: 9/15/2009 - 9/17/2009
Location: McCormick Place, Chicago
Chicago, IL
View Details

Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML