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

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

Computer Consulting by James R Johnson 3
(512) 833-7655
12100 Cabana Ln
Austin, TX
Data Magic
(972) 241-4771
1401 E Sandy Lake Rd
Lewisville, TX
Software Decisions Inc
(713) 523-9911
5821 Southwest Fwy Ste 206
Houston, TX
Agr Associates
(512) 250-9609
10140 Brimfield Dr
Austin, TX
Relcomp System Inc
(972) 527-6451
1212 Colmar Dr
Plano, TX
Preston Group the
(972) 250-0206
5325 Bent Tree Forest Dr
Dallas, TX
Harbour Group Inc
(512) 343-6365
11149 Research Blvd
Austin, TX
Zensar
(972) 331-2603
1825 W Walnut Ln
Dallas, TX
S H C Solutions
(972) 243-9988
2665 Villa Creek Dr
Dallas, TX
Athens Group Inc
(713) 960-5094
4201 Southwest Fwy
Houston, TX

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

ObjectWin Technology, Inc.

7133371834
2650 Fountain View Drive, Suite 405
Houston, TX
http://objectwin.com/OracleSolutions.aspx

Related Local Events
Subsea Tieback Exhibition (SSTB)
Dates: 3/2/2010 - 3/4/2010
Location: Moody Gardens Hotel & Convention Center
Galveston, TX
View Details

Deep Offshore Technology (DOT 2010)
Dates: 2/2/2010 - 2/4/2010
Location: George R. Brown Convention Center
Houston, TX
View Details

2009 IEEE Industry Applications Society Annual Meeting
Dates: 10/4/2009 - 10/7/2009
Location: Hyatt Regency Houston
Houston, TX
View Details

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