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

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

Sanritz America Inc
(619)421 8251
891 Kuhn DR
Chula Vista, CA
iMobile Tech
(619)843 7762
1905 Palomar Rd # 5
Chula Vista, CA
Jones Peter Computer Consulting
(415) 752-7239
558 29th Ave
San Francisco, CA
Glory USA Corp
(714) 897-7545
11205 Knott Ave
Cypress, CA
Dynamic F P C Design Inc
(760) 723-2102
2082 Vista Valle Verde Dr
Fallbrook, CA
New Vision Information Systems Inc
(619)482 2613
820 Starboard St
Chula Vista, CA
Elite Computers
(619)656 6606
2260 Otay Lakes Rd#106
Chula Vista, CA
Delta Management Systems
(619) 445-0800
3803 Via Palo Verde Lago
Alpine, CA
Logicube Inc
(818) 700-8488
19755 Nordhoff Pl
Chatsworth, CA
Palo Alto Consultants Inc
(310) 792-0677
Torrance, CA

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

New Vision Information Systems Inc

(619)482 2613
820 Starboard St
Chula Vista, CA

Related Local Events
REAL-TIME & EMBEDDED COMPUTING CONFERENCE - SAN DIEGO 2009
Dates: 9/29/2009 - 9/29/2009
Location: Four Points by Sheraton San Diego
San Diego, CA
View Details

Real-Time & Embedded Computing Conference-San Diego (RTECC)
Dates: 9/29/2009 - 9/29/2009
Location: Four Points Sheraton San Diego
San Diego, CA
View Details

SANS Network Security 2009
Dates: 9/14/2009 - 9/22/2009
Location: Manchester Grand Hyatt Hotel
San Diego, CA
View Details

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