Link to home
Start Free TrialLog in
Avatar of JanetG
JanetG

asked on

SDI app with no border

I want to create an SDI app with no border, title bar, min/max or system menu.  I tried to do this in the PreCreateWindow() of my class derived from CFrameWnd but my negating the WS_SYSMENU, WS_CAPTION, WS_BORDER, and WS_THICKFRAME just get ignored.  On advice from another user I did the following in InitInstance() of CMyApp:

m_pMainWnd->ModifyStyle(WS_CAPTION | WS_THICKFRAME |    WS_BORDER, WS_CLIPCHILDREN );
m_pMainWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE |    SWP_NOSIZE |
   SWP_NOZORDER | SWP_DRAWFRAME);
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

For reasons I don't understand, the WS_BORDER in the above code makes the difference between a title bar showing up or not.  But with the WS_BORDER, I of course get a border around my app.

So, my question is this: how can I create an SDI app without a border, min/max, system menu and title bar?

Thanks!

Avatar of umesh053097
umesh053097

You could try using SetWindowLong or SetClassLong in the OnCreatehandler of the derived CFrameWnd class after the default OnCreate.For example,if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
            return -1;DWORD dwClassStyle = ::GetClassLong(m_hWnd, GCL_STYLE);
dwClassStyle |= CS_SAVEBITS;
::SetClassLong(m_hWnd, GCL_STYLE, dwClassStyle);
Avatar of JanetG

ASKER

No, this doesn't have any affect (and in fact I had already tried this).  If I spy on the window I see the styles are turned off--but for some reason I continue to see a border around my app.

Before replying with suggestions, please just give it a try.  Try to create an SDI app with no border, no title bar, no system menu, and no min/max.

Thanks.


TrySetWindowLong(m_hWnd, GWL_STYLE, WS_POPUP);
Seems to work.
PreCreateWindow() should work. Can you post your PreCreateWindow() code here ?
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial