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

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

QED Connect
(603)881-3884
2 Townsend West Unit 1
Nashua, NH
Dumont Associates Inc
(603) 883-9400
15B Charron Ave
Nashua, NH
Enterprise Management Associates
(603) 766-5500
75 Congress St
Portsmouth, NH
Solzon Corp
(603) 485-9277
31 Donna Dr
Pembroke, NH
Accord Information Systems Inc
(603) 669-5600
451 Pepsi Rd
Manchester, NH
Right Networks
(603) 324-0403
12 Technology Way
Nashua, NH
Keynet Inc
(603) 890-5355
115 Indian Rock Rd
Windham, NH
Embedded Edge Llc
(603) 880-1414
46 Technology Way
Nashua, NH
Sriven Infosys Inc
(603) 886-1400
Nashua, NH
Jinks Technology Management
(603) 882-8222
74 Northeastern Blvd Ste 22A
Nashua, NH

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

QED Connect

SaaS provider for the mobile work force

(603)881-3884
2 Townsend West Unit 1
Nashua, NH
www.qedconnect.com

QED Connect, Inc. is an information security Software-as-a-Service (SaaS) provider that gives organizations visibility, management and control of activity on all their computers, laptops and wireless devices. The company’s popular SaaS, Omni Manager, is an affordable way to monitor and manage how employees are using company computers and the Internet at any time, from any location in the world. This solves the problems created by today’s ‘virtual’ work environment of branch offices, remote workers and traveling employees. Omni Manager is a web-hosted software application that includes e-mail and Internet filtering and blocking, antivirus, instant messaging management, asset tracking, application usage monitoring and policy management. ROI is delivered by employee productivity gains, cost savings and improved operational efficiencies.

Related Local Events
Thin Film & Crystal Growth Mechanisms 2009
Dates: 7/12/2009 - 7/17/2009
Location: Colby Sawyer College
New London, NH
View Details

Physical Organic Chemistry 2009
Dates: 6/28/2009 - 7/3/2009
Location: Holderness School
Plymouth, NH
View Details

Atomic Physics 2009
Dates: 6/28/2009 - 7/3/2009
Location: Tilton School
Tilton, NH
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