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.
Re: How to display a window with no caption bar
use the ModifyStyle function.
Ex.
ModifyStyle(0, WS_CAPTION);
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]
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)
{
::DestroyMenu(cs.hMenu);
cs.hMenu = NULL;
}
return CFrameWnd::PreCreateWindow(cs);
}
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.
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);
}