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

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

Central Telephone
509-773-4472
1505 S. Grant
Goldendale, OR
Gorge Networks
541-386-8300
616 Industrial Way
Hood River, OR
Embarq
1-800-877-1125
902 Wasco
Hood River, OR
Advantyx Software LLC
503-246-9299
6501 SW Macadam Ave
Portland, OR
Vision33
971-255-0162
The Lincoln Center, 10260 SW Greenburg Road, 4th Floor
Portland, OR
Artisan Software Tools Inc
503-245-6200
10220 SW Greenburg Rd
Portland, OR
Axis Clinical Software Inc
503-292-3022
6443 SW Beaverton Hillsdale Hwy
Portland, OR
Cendix
503.789.2676
501 4th Street, Suite 741
Lake Oswego, OR
Cascade Custom Software
503-922-0135
1000 SW Broadway
Portland, OR
Aravo Solutions
503-224-4049
2627 NW Nicolai 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

Central Telephone

509-773-4472
1505 S. Grant
Goldendale, OR

Regional Articles
- Code to View/Hide Status Bar in SDI and MDI Applications Albany OR
- Code to View/Hide Status Bar in SDI and MDI Applications Beaverton OR
- Code to View/Hide Status Bar in SDI and MDI Applications Bend OR
- Code to View/Hide Status Bar in SDI and MDI Applications Canby OR
- Code to View/Hide Status Bar in SDI and MDI Applications Central Point OR
- Code to View/Hide Status Bar in SDI and MDI Applications Clackamas OR
- Code to View/Hide Status Bar in SDI and MDI Applications Coos Bay OR
- Code to View/Hide Status Bar in SDI and MDI Applications Corvallis OR
- Code to View/Hide Status Bar in SDI and MDI Applications Eugene OR
- Code to View/Hide Status Bar in SDI and MDI Applications Forest Grove OR
- Code to View/Hide Status Bar in SDI and MDI Applications Grants Pass OR
- Code to View/Hide Status Bar in SDI and MDI Applications Gresham OR
- Code to View/Hide Status Bar in SDI and MDI Applications Hermiston OR
- Code to View/Hide Status Bar in SDI and MDI Applications Hillsboro OR
- Code to View/Hide Status Bar in SDI and MDI Applications Hood River OR
- Code to View/Hide Status Bar in SDI and MDI Applications Klamath Falls OR
- Code to View/Hide Status Bar in SDI and MDI Applications La Grande OR
- Code to View/Hide Status Bar in SDI and MDI Applications Lake Oswego OR
- Code to View/Hide Status Bar in SDI and MDI Applications Lebanon OR
- Code to View/Hide Status Bar in SDI and MDI Applications Mcminnville OR
- Code to View/Hide Status Bar in SDI and MDI Applications Medford OR
- Code to View/Hide Status Bar in SDI and MDI Applications Newberg OR
- Code to View/Hide Status Bar in SDI and MDI Applications North Bend OR
- Code to View/Hide Status Bar in SDI and MDI Applications Oregon City OR
- Code to View/Hide Status Bar in SDI and MDI Applications Pendleton OR
- Code to View/Hide Status Bar in SDI and MDI Applications Portland OR
- Code to View/Hide Status Bar in SDI and MDI Applications Prineville OR
- Code to View/Hide Status Bar in SDI and MDI Applications Roseburg OR
- Code to View/Hide Status Bar in SDI and MDI Applications Salem OR
- Code to View/Hide Status Bar in SDI and MDI Applications Springfield OR
- Code to View/Hide Status Bar in SDI and MDI Applications The Dalles OR
- Code to View/Hide Status Bar in SDI and MDI Applications Troutdale OR
- Code to View/Hide Status Bar in SDI and MDI Applications Tualatin OR
- Code to View/Hide Status Bar in SDI and MDI Applications West Linn OR
- Code to View/Hide Status Bar in SDI and MDI Applications Wilsonville OR
- Code to View/Hide Status Bar in SDI and MDI Applications Woodburn OR
Related Local Events
WOOD TECHNOLOGY CLINIC & SHOW 2010
Dates: 3/9/2010 - 3/11/2010
Location: Oregon Convention Center
Portland, OR
View Details

Party in the Pinot
Dates: 7/25/2009 - 7/25/2009
Location: Oswego Hills Winery
West Linn, OR
View Details

WebVisions 2009
Dates: 5/20/2009 - 5/22/2009
Location: Oregon Convention Center
Portland, OR
View Details

Technology and IP Networking Event
Dates: 5/19/2009 - 5/19/2009
Location: Oregon Zoo
Portland, OR
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