Code to View/Hide Status Bar in SDI and MDI Applications Sevierville TN

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

M P Data
(423) 349-7744
113 Foxport Rd
Kingsport, TN
P & E Development
(901) 368-0633
Memphis, TN
C-Corp Inc
(865) 947-9231
2907 W Beaver Creek Dr
Powell, TN
Business Computer Resources Inc
(865) 694-2007
111 S David Ln
Knoxville, TN
Jwc Computer Communications
(865) 584-9075
6513 Deane Hill Dr
Knoxville, TN
Niteowl Computing
(865) 429-1181
1909 Upper Middle Creek R
Sevierville, TN
Professional Data Services
(901) 757-4036
2205 Wentworth Ln
Germantown, TN
Kenneth G Way & Co
(423) 892-5867
7735 Legends Way
Chattanooga, TN
X O R
(615) 777-3101
150 2nd Ave N Ste 330
Nashville, TN
Bryant Ben C
(901) 754-6577
3800 Forest Hill Irene Rd
Memphis, TN

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

Techstrategists

865.246.1075
2450 EJ Chapman Dr.
Knoxville, TN

Related Articles
- Advanced C++/CLI Sevierville TN
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.
- Visual Basic .NET Attributes Sevierville TN
- JavaBean Proxies Sevierville TN
- Enumerate NT services Sevierville TN
- Placing Logo on the Top DockBar of the Frame Window Sevierville TN
- Audio Mixer Control Classes Sevierville TN
- Extending CPictureHolder for loading BMP, JPG, etc. Sevierville TN
- Avoiding Boolean Overload Sevierville TN
- Interacting with .NET WinForms, Part 1 Sevierville TN
- ListBox with Grayed Out / Non-Selectable Items Sevierville TN
Related Articles
- Advanced C++/CLI Sevierville TN
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.
- Visual Basic .NET Attributes Sevierville TN
- JavaBean Proxies Sevierville TN
- Enumerate NT services Sevierville TN
- Placing Logo on the Top DockBar of the Frame Window Sevierville TN
- Audio Mixer Control Classes Sevierville TN
- Extending CPictureHolder for loading BMP, JPG, etc. Sevierville TN
- Avoiding Boolean Overload Sevierville TN
- Interacting with .NET WinForms, Part 1 Sevierville TN
- ListBox with Grayed Out / Non-Selectable Items Sevierville TN

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