CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Guest

    How to display a window with no caption bar

    Hi, I try to use CSrollView in my application. To do this, I can use VC++ to create a SDI application and select CScrollView in the creation process. But in my application, I don't want to see any caption bar, system menu, and windows border. I don't know how to do it. Does anyone know how to do it? Thanks.


  2. #2
    Join Date
    May 1999
    Posts
    92

    Re: How to display a window with no caption bar

    use the ModifyStyle function.

    Ex.
    ModifyStyle(0, WS_CAPTION);


  3. #3
    Guest

    Re: How to display a window with no caption bar

    I have tried your solution to remove WS_CAPTION | WS_BORDER | WS_SYSMENU,
    but only system menu is removed. Why? Need further help.

    Best regards,

    Shaowen Cheng
    [email protected]


  4. #4
    Join Date
    May 1999
    Posts
    10

    Re: How to display a window with no caption bar

    override OnCreate() CMainFrame n use
    ModifyStyle( WS_CAPTION | WS_SYSMENU, 0);
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    // TODO: Add your specialized creation code here
    ModifyStyle( WS_CAPTION | WS_SYSMENU, 0);

    return 0;
    }
    //to remove menu bar
    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Modify the Window class or styles here by modifying
    // the CREATESTRUCT cs
    if (cs.hMenu != NULL)
    {
    :estroyMenu(cs.hMenu);
    cs.hMenu = NULL;
    }

    return CFrameWnd::PreCreateWindow(cs);
    }





  5. #5
    Join Date
    May 1999
    Location
    Republic of Korea
    Posts
    74

    Re: How to display a window with no caption bar

    Try to add WS_POPUP style to your main frame window.
    Overlapped windows ( WS_OVERLAPPED, this is the default style) should have caption bar.



  6. #6
    Join Date
    May 1999
    Posts
    10

    Re: How to display a window with no caption bar

    in ur precreatewindow()
    add
    cs.style = WS_DLGFRAME as well besides modifystyle()...
    Example:

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Modify the Window class or styles here by modifying
    // the CREATESTRUCT cs
    cs.style = WS_DLGFRAME;
    return CFrameWnd::PreCreateWindow(cs);
    }



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured