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

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

Bell Industries Technology Solutions Group
317-704-6000
8888 Keystone Xing
Indianapolis, IN
GT Solutions
317-844-3510
250 E 96th St
Indianapolis, IN
Peartree Software Consulting
317-257-2486
600 Holliday Ln
Indianapolis, IN
Professional Solutions
317-255-1944
2040 E 54th St
Indianapolis, IN
Sanyog Computer Solutions
317-579-0746
8650 Malaga DR
Indianapolis, IN
Seven Opals Software LLC
317-569-1810
1537 Sierra Spgs
Indianapolis, IN
Sterling Creek Software
317-567-5060
5881 E 82nd St
Indianapolis, IN
Advanced Solutions Inc
260-432-9695
7030 Pointe Inverness Way
Fort Wayne, IN
Britannia Inc
260-482-6321
1616 Directors Row
Fort Wayne, IN
CBS Computer Repair
260-441-9000
2727 Stardale Dr
Fort Wayne, IN

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

Bell Industries Technology Solutions Group

317-704-6000
8888 Keystone Xing
Indianapolis, IN

Regional Articles
- Code to View/Hide Status Bar in SDI and MDI Applications Anderson IN
- Code to View/Hide Status Bar in SDI and MDI Applications Angola IN
- Code to View/Hide Status Bar in SDI and MDI Applications Bedford IN
- Code to View/Hide Status Bar in SDI and MDI Applications Bloomington IN
- Code to View/Hide Status Bar in SDI and MDI Applications Brazil IN
- Code to View/Hide Status Bar in SDI and MDI Applications Brownsburg IN
- Code to View/Hide Status Bar in SDI and MDI Applications Carmel IN
- Code to View/Hide Status Bar in SDI and MDI Applications Chesterton IN
- Code to View/Hide Status Bar in SDI and MDI Applications Columbia City IN
- Code to View/Hide Status Bar in SDI and MDI Applications Columbus IN
- Code to View/Hide Status Bar in SDI and MDI Applications Connersville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Crawfordsville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Crown Point IN
- Code to View/Hide Status Bar in SDI and MDI Applications Dyer IN
- Code to View/Hide Status Bar in SDI and MDI Applications East Chicago IN
- Code to View/Hide Status Bar in SDI and MDI Applications Elkhart IN
- Code to View/Hide Status Bar in SDI and MDI Applications Evansville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Fishers IN
- Code to View/Hide Status Bar in SDI and MDI Applications Fort Wayne IN
- Code to View/Hide Status Bar in SDI and MDI Applications Franklin IN
- Code to View/Hide Status Bar in SDI and MDI Applications Gary IN
- Code to View/Hide Status Bar in SDI and MDI Applications Goshen IN
- Code to View/Hide Status Bar in SDI and MDI Applications Granger IN
- Code to View/Hide Status Bar in SDI and MDI Applications Greenfield IN
- Code to View/Hide Status Bar in SDI and MDI Applications Greenwood IN
- Code to View/Hide Status Bar in SDI and MDI Applications Hammond IN
- Code to View/Hide Status Bar in SDI and MDI Applications Hobart IN
- Code to View/Hide Status Bar in SDI and MDI Applications Huntington IN
- Code to View/Hide Status Bar in SDI and MDI Applications Indianapolis IN
- Code to View/Hide Status Bar in SDI and MDI Applications Jeffersonville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Kendallville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Kokomo IN
- Code to View/Hide Status Bar in SDI and MDI Applications Lafayette IN
- Code to View/Hide Status Bar in SDI and MDI Applications Laporte IN
- Code to View/Hide Status Bar in SDI and MDI Applications Logansport IN
- Code to View/Hide Status Bar in SDI and MDI Applications Marion IN
- Code to View/Hide Status Bar in SDI and MDI Applications Martinsville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Merrillville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Michigan City IN
- Code to View/Hide Status Bar in SDI and MDI Applications Mishawaka IN
- Code to View/Hide Status Bar in SDI and MDI Applications Muncie IN
- Code to View/Hide Status Bar in SDI and MDI Applications Munster IN
- Code to View/Hide Status Bar in SDI and MDI Applications New Albany IN
- Code to View/Hide Status Bar in SDI and MDI Applications New Castle IN
- Code to View/Hide Status Bar in SDI and MDI Applications Newburgh IN
- Code to View/Hide Status Bar in SDI and MDI Applications Noblesville IN
- Code to View/Hide Status Bar in SDI and MDI Applications North Vernon IN
- Code to View/Hide Status Bar in SDI and MDI Applications Peru IN
- Code to View/Hide Status Bar in SDI and MDI Applications Portage IN
- Code to View/Hide Status Bar in SDI and MDI Applications Richmond IN
- Code to View/Hide Status Bar in SDI and MDI Applications Schererville IN
- Code to View/Hide Status Bar in SDI and MDI Applications Seymour IN
- Code to View/Hide Status Bar in SDI and MDI Applications Shelbyville IN
- Code to View/Hide Status Bar in SDI and MDI Applications South Bend IN
- Code to View/Hide Status Bar in SDI and MDI Applications Terre Haute IN
- Code to View/Hide Status Bar in SDI and MDI Applications Valparaiso IN
- Code to View/Hide Status Bar in SDI and MDI Applications Vincennes IN
- Code to View/Hide Status Bar in SDI and MDI Applications Wabash IN
- Code to View/Hide Status Bar in SDI and MDI Applications Warsaw IN
- Code to View/Hide Status Bar in SDI and MDI Applications West Lafayette IN
- Code to View/Hide Status Bar in SDI and MDI Applications Zionsville IN
Related Articles
- Visual Basic .NET Attributes Indiana
Attributes are classes that allow individual developers to extend VS.NET tools without rebuilding VS.NET each time. Many attributes are already available, but most of the interesting ones haven't even been written yet. Perhaps you will do so.
- ListBox with Grayed Out / Non-Selectable Items Indiana
- Placing Logo on the Top DockBar of the Frame Window Indiana
- Enumerate NT services Indiana
- Avoiding Boolean Overload Indiana
- Audio Mixer Control Classes Indiana
- Interacting with .NET WinForms, Part 1 Indiana
- Advanced C++/CLI Indiana
- JavaBean Proxies Indiana
- Extending CPictureHolder for loading BMP, JPG, etc. Indiana
Related Local Event
Live, Learn, & Intern - XBOX Tournament @ Aptera
Dates: 7/30/2009 - 7/30/2009
Location: Aptera Software, Inc.
Fort Wayne, IN
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