Code to View/Hide Status Bar in SDI and MDI Applications Derby KS

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

Jaray Software
(316) 267-5758
2030 S Mead St
Wichita, KS
Backup Solutions
(316) 944-4448
2707 W Douglas Ave Ste B
Wichita, KS
Professional Software Inc
(316) 269-4264
800 E 1st St Ste 150
Wichita, KS
Midwest CAM Solutions (GibbsCAM)
877-444-0982
NOW SERVING: KANSAS
Wichita, KS
Arkane Systems
(316) 303-9579
1707 N Burns St
Wichita, KS
Access Group LLC
(316) 264-0270
348 Ida St.
Wichita, KS
The Carnahan Group
316-634-6767
1551 Waterfront Parkway ste 110
Wichita, KS
Vertical Solutions Inc
(316) 941-9429
2142 W Maple St
Wichita, KS
Allen Gibbs & Houlik L C Agh
(316) 267-7231
301 N Main St Ste 1700 Epic Center
Wichita, KS
C E M Systems Inc
(316) 264-6116
1609 E 2nd St N
Wichita, KS

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

Access Group LLC

(316) 264-0270
348 Ida St.
Wichita, KS

Related Articles
- Visual Basic .NET Attributes Derby KS
Attributes are classes that allow individual developers to extend VS.NET tools without rebuilding VS.NET each time. Many attributes are already available, but most of the interesting ones haven't even been written yet. Perhaps you will do so.
- Avoiding Boolean Overload Derby KS
- Interacting with .NET WinForms, Part 1 Derby KS
- Extending CPictureHolder for loading BMP, JPG, etc. Derby KS
- Placing Logo on the Top DockBar of the Frame Window Derby KS
- Advanced C++/CLI Derby KS
- ListBox with Grayed Out / Non-Selectable Items Derby KS
- JavaBean Proxies Derby KS
- Audio Mixer Control Classes Derby KS
- Enumerate NT services Derby KS
Related Articles
- Visual Basic .NET Attributes Derby KS
Attributes are classes that allow individual developers to extend VS.NET tools without rebuilding VS.NET each time. Many attributes are already available, but most of the interesting ones haven't even been written yet. Perhaps you will do so.
- Avoiding Boolean Overload Derby KS
- Interacting with .NET WinForms, Part 1 Derby KS
- Extending CPictureHolder for loading BMP, JPG, etc. Derby KS
- Placing Logo on the Top DockBar of the Frame Window Derby KS
- Advanced C++/CLI Derby KS
- ListBox with Grayed Out / Non-Selectable Items Derby KS
- JavaBean Proxies Derby KS
- Audio Mixer Control Classes Derby KS
- Enumerate NT services Derby KS
Related Local Event
Influencing without Authority
Dates: 12/3/2009 - 12/3/2009
Location: CMD Training Center WSU campus
Wichita, KS
View Details

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