Code to View/Hide Status Bar in SDI and MDI Applications Fairhaven MA

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

Mattimekeeping Systems
(781) 237-7695
9 Smith St
Wellesley, MA
Special Agent Inc
(781) 767-4085
181 S Franklin St
Holbrook, MA
Logico Software
(978) 531-0096
116 Main St
Peabody, MA
I Services Inc
(978) 635-1900
Acton, MA
Transtech
(508) 655-2322
16 Ecs Tech Cir
Natick, MA
Raybeam Solutions Inc
(781) 280-0624
131 Great Rd
Bedford, MA
Spherion Technology
(617) 542-1700
800 Boylston St Ste 1425
Boston, MA
New England Systems Engineering
(508) 947-7136
321 W Grove St
Middleboro, MA
Liaison International Inc
(617) 923-3835
311 Arsenal St
Watertown, MA
Esi Enterprises
(617) 527-4343
1188 Centre St
Newton Center, MA

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

Carlo Gavazzi Computing Solutions

(508) 588-6110
10 Mupac Drive
Brockton, MA

Related Local Events
Annual Lighting of the Pilgrim Monument
Dates: 11/25/2009 - 11/25/2009
Location: Pilgrim Monument
Provincetown, MA
View Details

Annual Lighting of the Pilgrim Monument
Dates: 11/23/2009 - 11/27/2009
Location: Pilgrim Monument High Pole Hill Road
Provincetown, MA
View Details

EMBEDDED SYSTEMS CONFERENCE - BOSTON 2009
Dates: 9/21/2009 - 9/24/2009
Location: Hynes Convention Center
Boston, MA
View Details

Software Development Best Practices 2009
Dates: 9/21/2009 - 9/24/2009
Location: Hynes Convention Center
Boston, MA
View Details

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