Code to View/Hide Status Bar in SDI and MDI Applications Northport AL

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

Connecting Point
(205) 758-2000
94 McFarland Blvd
Northport, AL
United Controls Corp
(256) 971-6144
6767 Old Madison Pike NW
Huntsville, AL
Sjc Associates Inc
(205) 620-9980
1713 Fieldstone Cir
Helena, AL
General Standards Co
(256) 880-8787
8302 Whitesburg Dr S Ste A
Huntsville, AL
Geographic Information Services Inc
(205) 941-0442
216 Aquarius Dr
Birmingham, AL
Applied Infotech Inc
(205) 758-1603
501 Bridge Ave
Northport, AL
Saic Science Applications International Corp
(334) 260-7050
4001 Carmichael Rd Ste 320
Montgomery, AL
Jackson Key & Associates
(251) 432-4925
216 Saint Michael St
Mobile, AL
Venture Technologies
(205) 989-8484
2100 Riverchase Ctr
Birmingham, AL
Creative Services Software
(256) 381-6100
503 W State St
Muscle Shoals, AL

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

Doozer Software Inc

205-413-8302
2 Chase Corporate DR
Birmingham, AL

Related Articles
- Advanced C++/CLI Northport AL
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 Northport AL
- Extending CPictureHolder for loading BMP, JPG, etc. Northport AL
- ListBox with Grayed Out / Non-Selectable Items Northport AL
- Enumerate NT services Northport AL
- Avoiding Boolean Overload Northport AL
- Interacting with .NET WinForms, Part 1 Northport AL
- Audio Mixer Control Classes Northport AL
- Placing Logo on the Top DockBar of the Frame Window Northport AL
- JavaBean Proxies Northport AL
Related Articles
- Advanced C++/CLI Northport AL
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 Northport AL
- Extending CPictureHolder for loading BMP, JPG, etc. Northport AL
- ListBox with Grayed Out / Non-Selectable Items Northport AL
- Enumerate NT services Northport AL
- Avoiding Boolean Overload Northport AL
- Interacting with .NET WinForms, Part 1 Northport AL
- Audio Mixer Control Classes Northport AL
- Placing Logo on the Top DockBar of the Frame Window Northport AL
- JavaBean Proxies Northport AL
Related Local Event
Going Green Awards
Dates: 10/1/2009 - 10/1/2009
Location: Sheraton
North Birmingham, AL
View Details

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