Code to View/Hide Status Bar in SDI and MDI Applications Woodburn OR

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

Jada Management Systems
(503) 744-0710
19775 Derby Street
West Linn, OR
Go Flight Inc
(503) 671-9317
11855 SW Ridgecrest Dr
Beaverton, OR
Advanced Systems Concepts Inc
(541) 386-2225
514 State St
Hood River, OR
Software Concepts Inc
(503) 641-1060
8095 SW Cirrus Dr
Beaverton, OR
Extreme Arts & Sciences
(541) 345-5764
296 E 5th Ave Ste 401
Eugene, OR
Jada Management Systems
(503) 744-0710
19775 Derby Street
West Linn, OR
Cendix
503.789.2676
501 4th Street, Suite 741
Lake Oswego, OR
Symatrix Technology Inc
(503) 892-6080
10260 SW Greenburg Rd Ste 950
Portland, OR
Computer Solutions Unlimited
(503) 667-4682
Gresham, OR
Mueller Stephen R
(503) 222-3055
1805 NW Glisan St
Portland, OR

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

Jada Management Systems

(503) 744-0710
19775 Derby Street
West Linn, OR
http://www.jadaman.com

3PLs, Freight Forwarders, Manufacturers, and distributors in 12 countries have discovered that managing a supply chain does not have to be a time consuming, high cost, or high risk venture.

SCP 4.0 is designed to overcome the integration difficulties, technical resource constraints, and economics of implementing and running supply chain planning systems.

USER FRIENDLY, IT FRIENDLY, CFO FRIENDLY
SCP combines power, simplicity, flexibility & intuitiveness.

UNRIVALED IMPLEMENTATION SPEED
Our unique integration capabilities allow SCP to be fully implemented in an average of 2 weeks at an all inclusive cost of less than $55,000. Designed to overcome integration difficulties and resource constraints, SCP implements at a fraction of the time and cost of competing products.

QUICK ROI
Competitive pricing and unique features allow clients the luxury of instant gratification and a 6-12 month return on their investment

SCP… Work Smarter

Related Local Events
2010 InnoTech
Dates: 5/6/2010 - 5/6/2010
Location: Oregon Convention Center
Portland, OR
View Details

WOOD TECHNOLOGY CLINIC & SHOW 2010
Dates: 3/9/2010 - 3/11/2010
Location: Oregon Convention Center
Portland, OR
View Details

Intellectual Property: Commercialization & Protection
Dates: 2/17/2010 - 2/17/2010
Location: AHA!
Vancouver, WA
View Details

January Forum: The future of Portland's media industry
Dates: 1/20/2010 - 1/20/2010
Location: Governor Hotel
Portland, OR
View Details

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