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

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

Mersoft Corporation
913-871-6196
9300 W. 110th Street
Overland Park, KS
Access Group LLC
(316) 264-0270
348 Ida St.
Wichita, KS
Midwest CAM Solutions (GibbsCAM)
877-444-0982
NOW SERVING: KANSAS
Wichita, KS
Professional Software Inc
(316) 269-4264
800 E 1st St Ste 150
Wichita, KS
Allen Gibbs & Houlik L C Agh
(316) 267-7231
301 N Main St Ste 1700 Epic Center
Wichita, KS
Backup Solutions
(316) 944-4448
2707 W Douglas Ave Ste B
Wichita, KS
Brainworks Software
(316) 722-8100
7570 W 21st St N
Wichita, KS
C E M Systems Inc
(316) 264-6116
1609 E 2nd St N
Wichita, KS
Choice Solutions
(316) 293-2900
3020 N Cypress Ste 200
Wichita, KS
Vertical Solutions Inc
(316) 941-9429
2142 W Maple St
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

Mersoft Corporation

913-871-6196
9300 W. 110th Street
Overland Park, KS
www.mersoft.com

Regional Articles
- Code to View/Hide Status Bar in SDI and MDI Applications Arkansas City KS
- Code to View/Hide Status Bar in SDI and MDI Applications Derby KS
- Code to View/Hide Status Bar in SDI and MDI Applications Dodge City KS
- Code to View/Hide Status Bar in SDI and MDI Applications Emporia KS
- Code to View/Hide Status Bar in SDI and MDI Applications Garden City KS
- Code to View/Hide Status Bar in SDI and MDI Applications Great Bend KS
- Code to View/Hide Status Bar in SDI and MDI Applications Hays KS
- Code to View/Hide Status Bar in SDI and MDI Applications Hutchinson KS
- Code to View/Hide Status Bar in SDI and MDI Applications Junction City KS
- Code to View/Hide Status Bar in SDI and MDI Applications Kansas City KS
- Code to View/Hide Status Bar in SDI and MDI Applications Lawrence KS
- Code to View/Hide Status Bar in SDI and MDI Applications Leavenworth KS
- Code to View/Hide Status Bar in SDI and MDI Applications Leawood KS
- Code to View/Hide Status Bar in SDI and MDI Applications Lenexa KS
- Code to View/Hide Status Bar in SDI and MDI Applications Liberal KS
- Code to View/Hide Status Bar in SDI and MDI Applications Manhattan KS
- Code to View/Hide Status Bar in SDI and MDI Applications Mcpherson KS
- Code to View/Hide Status Bar in SDI and MDI Applications Olathe KS
- Code to View/Hide Status Bar in SDI and MDI Applications Overland Park KS
- Code to View/Hide Status Bar in SDI and MDI Applications Prairie Village KS
- Code to View/Hide Status Bar in SDI and MDI Applications Salina KS
- Code to View/Hide Status Bar in SDI and MDI Applications Shawnee KS
- Code to View/Hide Status Bar in SDI and MDI Applications Topeka KS
- Code to View/Hide Status Bar in SDI and MDI Applications Wichita KS
- Code to View/Hide Status Bar in SDI and MDI Applications Winfield KS
Related Local Events
Influencing without Authority
Dates: 12/3/2009 - 12/3/2009
Location: CMD Training Center WSU campus
Wichita, KS
View Details

Bio Science Committee
Dates: 6/11/2009 - 6/11/2009
Location: KCK Chamber
Kansas City, KS
View Details

Kansas Main Street Directors Quarterly Training
Dates: 5/19/2009 - 5/20/2009
Location: Downtown Vision & Finnup Center
Garden City, KS
View Details

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

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