Solved

SDI app with no border

Posted on 1997-06-03
5
673 Views
Last Modified: 2013-11-20
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!

0
Comment
Question by:JanetG
5 Comments
 

Expert Comment

by:umesh053097
ID: 1301952
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);
0
 

Author Comment

by:JanetG
ID: 1301953
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.


0
 

Expert Comment

by:umesh053097
ID: 1301954
TrySetWindowLong(m_hWnd, GWL_STYLE, WS_POPUP);
Seems to work.
0
 
LVL 3

Expert Comment

by:byang
ID: 1301955
PreCreateWindow() should work. Can you post your PreCreateWindow() code here ?
0
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1301956
Do the following in your frame window PreCreateWindow(),

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    cs.style = WS_POPUP | WS_VISIBLE;  // or others you want
    cs.dwExStyle = 0;  // or others you want

    return CFrameWnd::PreCreateWindow(cs);
}

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 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