Solved

SDI app with no border

Posted on 1997-06-03
5
640 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now