Solved

MFC App with full-screen windows

Posted on 1997-09-24
3
718 Views
Last Modified: 2013-11-19
I am designing a MFC application.  The app is required to navigate between full screen windows using bitmapped buttons.

The windows will contain some bitmaps with hotspot areas that will bring up pop-up menus when clicked.  The window will also contain bitmap buttons and possibly some other controls.
I am interested in the most flexible and straightforward approach to displaying and switching these windows.  Some example or references to published articles would be appreciated.
0
Comment
Question by:rhgaracci
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Author Comment

by:rhgaracci
ID: 1306921
Edited text of question
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 100 total points
ID: 1306922
MS KB has full screen code and sample (see below)

Your "windows" sound like dialogs so a CFormView is probably approriate - just design your view with the dialog editor.

The hot spots can be detected by overriding to OnMouseMove
 to detect the spot, and then popping up a menu with TrackPopupMenu.

SAMPLE: Adding a Full Screen Feature to an MFC Application

Article ID: Q164162
Creation Date: 24-FEB-1997
Revision Date: 01-APR-1997

The information in this article applies to:
•The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2

SUMMARY

The FSCRN sample includes code that you can use to add a Full Screen feature to a Visual C++ 4.x MFC Application. This is similar to what you see when you select the Full Screen menu item in Microsoft Developer Studio. The code shows which functions must be created and demonstrates how you can create a floating toolbar, which you can click to undo the Full Screen mode.

The following file is available for download from the Microsoft Software Library:

 ~ Fscrn.exe (size: 45962 bytes)

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION

The sample code below has been added to the CMainFrame class of the AppWizard-generated application. Here is a list of the four functions and what they accomplish:

1.OnViewFullScreen - Handler for the Full Screen menu item.

2.OnGetMinMaxInfo - Traps the WM_GETMINMAXINFO message to allow you to increase the size of the window.

3.IsFullScreen- Tests whether the application is in full screen mode.

4.OnUpdateViewFullScreen - Checks or unchecks the Full Screen menu item depending on the mode the application is in.

Sample Code

      void CMainFrame::OnViewFullScreen()
      {
          RECT rectDesktop;
          WINDOWPLACEMENT wpNew;
          if (!IsFullScreen())
          {
              // need to hide all status bars
              m_wndStatusBar.ShowWindow(SW_HIDE);
              m_wndToolBar.ShowWindow(SW_HIDE);
              // We'll need these to restore the original state.
              GetWindowPlacement (&m_wpPrev);
              m_wpPrev.length = sizeof m_wpPrev;
              //Adjust RECT to new size of window
              ::GetWindowRect ( ::GetDesktopWindow(), &rectDesktop );
          ::AdjustWindowRectEx(&rectDesktop, GetStyle(), TRUE,
              GetExStyle());
              // Remember this for OnGetMinMaxInfo()
              m_FullScreenWindowRect = rectDesktop;
              wpNew = m_wpPrev;
              wpNew.showCmd =  SW_SHOWNORMAL;
              wpNew.rcNormalPosition = rectDesktop;
              m_pwndFullScrnBar=new CToolBar;
          if(!m_pwndFullScrnBar->Create(this,
             CBRS_SIZE_DYNAMIC|CBRS_FLOATING)
                 || !m_pwndFullScrnBar->LoadToolBar(IDR_FULLSCREEN))
            {
            TRACE0("Failed to create toolbar\n");
                 return;      // fail to create
         }
               //don't allow the toolbar to dock
               m_pwndFullScrnBar->EnableDocking(0);
          m_pwndFullScrnBar->SetWindowPos(0,100,100,
0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);
          m_pwndFullScrnBar->SetWindowText(_T("Full Screen"));
            FloatControlBar(m_pwndFullScrnBar, CPoint(100,100));
          m_bFullScreen=TRUE;
          }
          else
          {
               m_pwndFullScrnBar->DestroyWindow();
          delete m_pwndFullScrnBar;
               m_bFullScreen=FALSE;
             m_wndStatusBar.ShowWindow(SW_SHOWNORMAL);
               m_wndToolBar.ShowWindow(SW_SHOWNORMAL);
               wpNew = m_wpPrev;
           }
           SetWindowPlacement ( &wpNew );
      }

      void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
      {
          if (IsFullScreen())
          {
              lpMMI->ptMaxSize.y = m_FullScreenWindowRect.Height();
              lpMMI->ptMaxTrackSize.y = lpMMI->ptMaxSize.y;
              lpMMI->ptMaxSize.x = m_FullScreenWindowRect.Width();
              lpMMI->ptMaxTrackSize.x = lpMMI->ptMaxSize.x;
          }
      }

      BOOL CMainFrame::IsFullScreen()
      {
           return m_bFullScreen;
      }

      void CMainFrame::OnUpdateViewFullScreen(CCmdUI* pCmdUI)
      {
          pCmdUI->Enable();
          if (IsFullScreen())
            pCmdUI->SetCheck();
          else
            pCmdUI->SetCheck(0);
      }
 
------------------------------------------------------------------------
Keywords : kbsample MfcDocView kbfile kbprg
Version : 4.0 4.1 4.2
Platform : NT WINDOWS
Resolution Type : kbcode

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

©1997 Microsoft Corporation. All rights reserved. Legal Notices.
0
 
LVL 1

Author Comment

by:rhgaracci
ID: 1306923
Thank you, that gives me another option.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question