Code to View/Hide Status Bar in SDI and MDI Applications Bessemer City NC

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

Decision Consultants Inc
(919) 852-5000
5511 Capital Center Dr
Raleigh, NC
Stragetic Technologies-Hosted Solutions Co-Lo
(919) 379-8000
111 Corning Rd
Cary, NC
Blue Canopy
(910) 867-2886
4200 Morganton Rd
Fayetteville, NC
Aquent Llc
(704) 338-9119
Charlotte, NC
Smci
(704) 375-5788
201 S Tryon St
Charlotte, NC
Charlotte Web Design & Development
(704) 577-8242
Commodore point rd
Lake Wylie, SC
Interactive Learning Systems Inc
(919) 644-6322
3828 Saint Marys Rd
Hillsborough, NC
Si International
(252) 447-0391
183 Wolfcreek Profession
Havelock, NC
Computer Consulting & Training
(336) 379-1988
Greensboro, NC
Guarino & Associates Inc
(336) 945-0631
9008 River Path Rd
Lewisville, NC

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

Charlotte Web Design & Development

7045778242
Commodore point rd
Lake Wylie, SC
http://www.charlottewebdevelopment.com

Related Local Events
Green Manufacturing Expo-Charlotte
Dates: 4/28/2010 - 4/29/2010
Location: Charlotte Convention Center
Charlotte, NC
View Details

Automation Technology Expo South
Dates: 4/28/2010 - 4/29/2010
Location: Charlotte Convention Center
Charlotte, NC
View Details

Making the Right Decision with Business Intelligence and Analytics, NCTA Emerging Technologies & Trends Series
Dates: 2/10/2010 - 2/10/2010
Location: Belk Action Center
Charlotte, NC
View Details

Technology Summit: Technology + Innovation = Our Future
Dates: 11/18/2009 - 11/18/2009
Location: Hilton Charlotte Center City
Charlotte, NC
View Details

NCTA Congressional Briefing: Featuring U.S. Representatives Sue Myrick and Larry Kissell
Dates: 11/2/2009 - 11/2/2009
Location: Charlotte Chamber - Belk Action Center
Charlotte, NC
View Details

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