Code to View/Hide Status Bar in SDI and MDI Applications Commerce Township MI

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

Protocol Syst C
313-534-8773
18201 W 8 Mile Rd
Detroit, MI
Repair Garys Computer
313-766-5265
20643 W 7 Mile Rd
Detroit, MI
Center for Computer Resources
248-663-4212
25900 Greenfield Rd
Oak Park, MI
Bof Tech
313-864-0235
18243 Freeland St
Detroit, MI
Novatech Computer Service Inc
313-341-7747
16856 Meyers Rd
Detroit, MI
INDUS USA
248-630-6209
31500 W 13 mile road
farmington hills, MI
Apocalypse Computer Studio
313-794-2920
16881 Burgess
Detroit, MI
Special Project Services
313-543-9502
17405 Winston St
Detroit, MI
PC Menders Computer Services
313-397-2713
18256 Grand River Ave
Detroit, MI
Learning Consultants Inc
313-861-5882
17601 James Couzens Fwy
Detroit, MI

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

INDUS USA

248-630-6209
31500 W 13 mile road
farmington hills, MI
http://www.indus-usa.com

Related Local Events
NAIAS 2010
Dates: 1/15/2010 - 1/15/2010
Location: COBO Convention Center
Detroit, OH
View Details

Real-Time & Embedded Computing Conference-Detroit (RTECC)
Dates: 9/17/2009 - 9/17/2009
Location: Sterling Inn Banquet & Conference Center, Detroit
Sterling Heights, MI
View Details

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