locked
How to control fullscreen MDI application client edges? RRS feed

  • Question

  • Hi 

      I'm writting an MDI(MFC) application with fullscreen feature, actually it's supposed to be running in fullscreen mode in live enviornment.

      The full screen function is coded fully follow this page, http://support.microsoft.com/kb/164162

       It always display 2pix 3D edges,  I tried to use OnPreCreateWindow to control the style of the ClientWindow, ChildFrame and even the View, but it never disapears. I even use dModifyStyle function to change the style of ClientWindow, and close all documents, the client edge was still there. I aslo tried to to subclass ClientWindow(of the main frame) so to control the background pating, I can only eliminate the right&bottom client edge.

      I ever wrote an SDI application in fullscreen, it has no such a problem at all though I use same approach on:  http://support.microsoft.com/kb/164162.

      So my question is, how can I eleminate all client edges? As there are layers of window in MDI, when you runng a progam in a full screen mode, it's very hard to judge which window the client edge belongs to. Any document describe how the client edge is controled for MDI?

    Tuesday, August 10, 2010 2:34 PM

Answers

  • That's because, in MFC code, every time an  MDI child is activated, the WS_EX_CLIENTEDGE is reapplied in the following code:

    void CMDIChildWnd::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd*)
    {
    [...]
        // make sure MDI client window has correct client edge
        UpdateClientEdge(); // its reapplied here.

    [...]

    }

    You have a couple of options:

    (i) Try to remove the style using ModifyStyle() after the base class OnMDIActivate() is called by handling the WM_MDIACTIVATE.
    (ii) You could copy the UpdateClientEdge() code from the baseclass  and skip the line where it adds the WS_EX_CLIENTEDGE
    (iii) Or I think handle the WM_STYLECHANGING message and if you see a WS_EX_CLIENTEDGE being added, remove it.

    -Seetharam

     

    • Marked as answer by rico on earth Thursday, December 9, 2010 5:11 AM
    Friday, November 5, 2010 2:46 PM

All replies

  • This is what I did in the sample app to remove the border.

    BOOL CFullScreenView::PreCreateWindow(CREATESTRUCT& cs)
    {
      cs.style &= ~WS_BORDER;
      return CView::PreCreateWindow(cs);
    }

     


    Ali

     

    Tuesday, August 10, 2010 5:43 PM
  • hi AliRafiee,

      It doesn't work for me, and I did not notice any change using your method.

    Wednesday, August 11, 2010 12:30 AM
  • Lastest discovery, by removing style of MDIS_ALLCHILDSTYLES of MDIClient window, the edges are removed.

    However, the view sizing is incorrect on the primary monitor, well it works pretty well on the sencondary monitor.

    In both case, the main window's title is not showing the document name anymore just afer removing the MDIS_ALLCHILDSTYLES sytle.

    Wednesday, October 27, 2010 12:44 AM
  • Pass by
    Wednesday, October 27, 2010 1:13 AM
  • Did you try removing WS_EX_CLIENTEDGE from the style of your "full screen" window? E.g.

      VERIFY(p->ModifyStyleEx(WS_EX_CLIENTEDGE, 0));
      VERIFY(p->SetWindowPos(NULL, 0, 0, 0, 0, 
       SWP_NOMOVE|
       SWP_NOSIZE|
       SWP_DRAWFRAME|
       SWP_NOZORDER|
       SWP_NOACTIVATE));
    
    

    Above did it for me, but I suspect that there should be a better way to force redrawing of the "3D" frame than SetWindowPos.

    Goran.

    Wednesday, October 27, 2010 8:15 AM
  • thanks, however, this approach doesn't resolve all issues, when you switch between views, the client edge comes out automatically.
    Friday, November 5, 2010 6:05 AM
  • That's because, in MFC code, every time an  MDI child is activated, the WS_EX_CLIENTEDGE is reapplied in the following code:

    void CMDIChildWnd::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd*)
    {
    [...]
        // make sure MDI client window has correct client edge
        UpdateClientEdge(); // its reapplied here.

    [...]

    }

    You have a couple of options:

    (i) Try to remove the style using ModifyStyle() after the base class OnMDIActivate() is called by handling the WM_MDIACTIVATE.
    (ii) You could copy the UpdateClientEdge() code from the baseclass  and skip the line where it adds the WS_EX_CLIENTEDGE
    (iii) Or I think handle the WM_STYLECHANGING message and if you see a WS_EX_CLIENTEDGE being added, remove it.

    -Seetharam

     

    • Marked as answer by rico on earth Thursday, December 9, 2010 5:11 AM
    Friday, November 5, 2010 2:46 PM
  • thanks, issue resolved.
    Thursday, December 9, 2010 5:12 AM