Code to View/Hide Status Bar in SDI and MDI Applications Elizabethtown KY

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

R & M Enterprises
(270) 737-2237
236 W Dixie Ave
Elizabethtown, KY
Mirazon Group
(270) 360-1901
Elizabethtown, KY
Dean Dorton & Ford Technology
(859) 255-2341
106 W Vine St Ste 600
Lexington, KY
Elysian Productions Inc
(502) 261-9350
5201 Oaklawn Park Dr
Louisville, KY
Evercom Systems
(606) 295-5597
2725 Highway 30 W
Jackson, KY
Computer Business Applications Inc
(270) 737-1888
PO Box 1356
Elizabethtown, KY
Service First Computing Llc
(270) 982-0879
Elizabethtown, KY
Healthcare Datalink Inc
(502) 231-8800
Louisville, KY
Robert Half Technology
(502) 394-0525
9300 Shelbyville Rd Ste 920
Louisville, KY
Pilgrim It
(502) 721-7939
1815 Brownsboro Rd
Louisville, KY

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

National Innovative Software Solutions LLC

502-495-0548
2108 Plantside DR
Louisville, KY

Related Articles
- Advanced C++/CLI Elizabethtown KY
C++/CLI has a number of advanced features that make developing and maintaining applications easier. Discover how these allow types to be moved between assemblies without breaking existing application, allow fast and efficient interoperability between native functions, and make it possible to create functions that take a variable number of parameters while still maintaining type safety.
- JavaBean Proxies Elizabethtown KY
- Audio Mixer Control Classes Elizabethtown KY
- Avoiding Boolean Overload Elizabethtown KY
- Enumerate NT services Elizabethtown KY
- Extending CPictureHolder for loading BMP, JPG, etc. Elizabethtown KY
- Visual Basic .NET Attributes Elizabethtown KY
- Placing Logo on the Top DockBar of the Frame Window Elizabethtown KY
- ListBox with Grayed Out / Non-Selectable Items Elizabethtown KY
- Interacting with .NET WinForms, Part 1 Elizabethtown KY
Related Articles
- Advanced C++/CLI Elizabethtown KY
C++/CLI has a number of advanced features that make developing and maintaining applications easier. Discover how these allow types to be moved between assemblies without breaking existing application, allow fast and efficient interoperability between native functions, and make it possible to create functions that take a variable number of parameters while still maintaining type safety.
- JavaBean Proxies Elizabethtown KY
- Audio Mixer Control Classes Elizabethtown KY
- Avoiding Boolean Overload Elizabethtown KY
- Enumerate NT services Elizabethtown KY
- Extending CPictureHolder for loading BMP, JPG, etc. Elizabethtown KY
- Visual Basic .NET Attributes Elizabethtown KY
- Placing Logo on the Top DockBar of the Frame Window Elizabethtown KY
- ListBox with Grayed Out / Non-Selectable Items Elizabethtown KY
- Interacting with .NET WinForms, Part 1 Elizabethtown KY

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