Code to View/Hide Status Bar in SDI and MDI Applications Asbury Park NJ

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

iCIMS
800-889-4422
1301 State Route 36
Hazlet, NJ
Lone Keep Systems
(732) 988-4044
Bradley Beach Area
Asbury Park, NJ
Lead Technologies Inc
(856) 616-1976
21 Tanner St
Haddonfield, NJ
Sharing Enterprises
(201) 261-3325
208 Kinderkamack Rd
Oradell, NJ
Fotografix Digital Attributes
(201) 447-1510
Ridgewood, NJ
Angel Computer Network Services
(201) 747-7111
1775 Highway 34, Building C5
Wall, NJ
Aquired Data Solutions
(732) 988-5560
807 Summerfield Ave
Asbury Park, NJ
Personal Software Dimensions Inc
(973) 383-5959
130 McPeek Rd
Lafayette, NJ
Quatran Llc
(732) 818-9693
82 Shady Nook Dr
Toms River, NJ
National Collectors Gallery
(201) 689-1211
41 N Broad St
Ridgewood, NJ

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

Angel Computer Network Services

2017477111
1775 Highway 34, Building C5
Wall, NJ
http://www.angelservices.com

Related Local Events
Biotechnica America
Dates: 4/20/2010 - 4/22/2010
Location: Jacob K. Javits Convention Center
New York, NY
View Details

TradeTech USA
Dates: 3/1/2010 - 3/3/2010
Location: Marriott Marquis New York
New York, NY
View Details

BIO CEO & INVESTOR CONFERENCE 2010
Dates: 2/8/2010 - 2/8/2010
Location: Waldorf-Astoria
New York, NY
View Details

Business Technology Forum
Dates: 1/8/2010 - 1/8/2010
Location: Chamber Offices
Fairless Hills, PA
View Details

I.T. Committee Meeting
Dates: 12/17/2009 - 12/17/2009
Location: Queens Chamber Board Room
Jackson Heights, NY
View Details

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