Code to View/Hide Status Bar in SDI and MDI Applications Newington CT

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

Microsoft
(860) 916-7448
74 Batterson Park Rd., Ste. 100
Farmington, CT
Coordinated Systems, Inc.
860-289-2151
165 Burnside Avenue
East Hartford, CT
Performance Display Systems
(860) 947-2122
705 N Mountain Rd
Newington, CT
Triadicon Inc
(203) 319-8308
887 Riverside Dr
Fairfield, CT
Onlmkee
(203) 288-0058
105 Sanford St
New Haven, CT
Tamion Company
800-582-9637
1178 Mill Street
East Berlin, CT
Nandvarik Systems
999-999-9999
Farmington
Hartford, CT
OFFiS Corporation
203-265-6700
61 N Plains Industrial Rd
Wallingford, CT
Cables & Connectors
(860) 665-9904
2307 Berlin Tpke
Newington, CT
Shoulders Corp
(203) 264-4331
555 Heritage Rd
Southbury, CT

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

Tamion Company

800-582-9637
1178 Mill Street
East Berlin, CT
http://www.tamion.com

Related Local Events
NET Series: Lunch Bunch
Dates: 1/5/2010 - 1/5/2010
Location: Maneeley's Banquet Facility & Catering
South Windsor, CT
View Details

The New Balancing Act
Dates: 11/5/2009 - 11/5/2009
Location: Acton Public Library
Old Saybrook, CT
View Details

The New Balancing Act
Dates: 11/3/2009 - 11/3/2009
Location: Estuary Council of Seniors
Old Saybrook, CT
View Details

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