Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Urgent !!! - How do I remove the title bar from a main window in Visual C++ 5.0

1,003 views
Skip to first unread message

Kim Leong

unread,
Sep 1, 1997, 3:00:00 AM9/1/97
to

Hi everyone,

I create a project using MFC Appwizard(exe), SDI and CFormView .
In the CMainFrame::PreCreateWindow class,
I change the cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
statement to the following
cs.style = WS_DLGFRAME
cs.style = WS_OVERLAPPED | ~WS_CAPTION
cs.style = WS_DLGFRAME | ~WS_CAPTION.
and more ...
but none of those above statements work.

I would very much appreciate if anyone can provide me with a real
solution. ( I have spent many hours already. )

Thanks in advance

Kim


CyBorch

unread,
Sep 3, 1997, 3:00:00 AM9/3/97
to

Robert Youdan wrote:
> A main window should have a title bar so users can drag it, close it,
> see what it is called etc! If you want to simulate a main window without
> a title, you may need to hide the main window and bring up an
> overlapped, child window that has no title.

that might be so, but if you would want to remove the title bar from a
window you could (fx) use the WS_POPUP style.

btw. look the WS_* styles up in winuser.h, the header files are a source
of documentation not to be overlooked...
________ _ ____ ______ _______ _______ _______ ___ ____
/ / \/ / __ \/ \| __ \/ / | |
/ _____/\ /| / | \ / ____/| | |
\ \ | | | __ \ | / \ \| |
\_______\|____| |_______/\_______/|___|___/\______\____|____|
#include <disclaimer.h>

Gordon Smith

unread,
Sep 5, 1997, 3:00:00 AM9/5/97
to

I got it to work some time ago in a VC++ 1.52 application by setting the
style to WS_POPUP but I couldn't get anything to work with VC++ 5.

--
Gordon Smith

Dean Roddey

unread,
Sep 10, 1997, 3:00:00 AM9/10/97
to

CyBorch wrote:
>
> Robert Youdan wrote:
> > A main window should have a title bar so users can drag it, close it,
> > see what it is called etc! If you want to simulate a main window without
> > a title, you may need to hide the main window and bring up an
> > overlapped, child window that has no title.
>
> that might be so, but if you would want to remove the title bar from a
> window you could (fx) use the WS_POPUP style.
>
> btw. look the WS_* styles up in winuser.h, the header files are a source
> of documentation not to be overlooked...

A side effect of not having a title bar (i.e. using WS_POPUP) is that
the user cannot close it or otherwise manipulate it via the task bar. In
other words the menu you popup over the task bar entry for the program
won't have any of the move/size/close/etc... entries in it, because
those are driven by the system meny entries of the program (and you
won't have any.) So provide some way for the user to do whatever is
needed via your program's interface I guess (or find some way to force
these entries into the task bar menu.)

I did a little system information display program a long time ago as an
entre into Win32 (from OS/2) and it used WS_POPUP and just put itself in
the upper right corner. But you couldn't close the little guy without
putting a close button on it, which took up valuable space because this
little program was intended to be as (visually) small as possible and
stay out of the way.

------------------------------------
Dean Roddey
Sr. Software Engineer
Taligent, Inc
dean_...@taligent.com

Rosa Bernárdez

unread,
Sep 11, 1997, 3:00:00 AM9/11/97
to

One way can be to overload CWnd::Create and remove the WS_CAPTION style
the call the base class Create method.

Rosa Bernárdez

Ken Thomas

unread,
Sep 11, 1997, 3:00:00 AM9/11/97
to

One solution is given in MSJ November 1995 C/C++ column by Paul
DiLascia. Haven't tried it myself, though.

Ken

Neelam Haer

unread,
Sep 11, 1997, 3:00:00 AM9/11/97
to


Dean Roddey wrote:

> CyBorch wrote:
> >
> > Robert Youdan wrote:

<snipped>

> A side effect of not having a title bar (i.e. using WS_POPUP) is that
> the user cannot close it or otherwise manipulate it via the task bar. In
> other words the menu you popup over the task bar entry for the program
> won't have any of the move/size/close/etc... entries in it, because
> those are driven by the system meny entries of the program (and you
> won't have any.) So provide some way for the user to do whatever is
> needed via your program's interface I guess (or find some way to force
> these entries into the task bar menu.)
>
> I did a little system information display program a long time ago as an
> entre into Win32 (from OS/2) and it used WS_POPUP and just put itself in
> the upper right corner. But you couldn't close the little guy without
> putting a close button on it, which took up valuable space because this
> little program was intended to be as (visually) small as possible and
> stay out of the way.
>

However, nowadays you don't necessarily have to put a button on the app, you
could use a popup menu that displays only when you right-click on the window,
from this one could choose to close the window, or what have you

NH


Rosa Bernárdez

unread,
Sep 12, 1997, 3:00:00 AM9/12/97
to

> Kim Leong wrote:
>
.......

> > cs.style = WS_OVERLAPPED | ~WS_CAPTION
> > cs.style = WS_DLGFRAME | ~WS_CAPTION.
......

> > Kim

You must try
cs.style = WS_OVERLAPPED & ~WS_CAPTION
cs.style = WS_DLGFRAME & ~WS_CAPTION.

Chris Marriott

unread,
Sep 12, 1997, 3:00:00 AM9/12/97
to

In article <3418ED...@delmono.tid.es>, =?iso-
8859-1?q?Rosa_Bern=E1rdez?= <r...@delmono.tid.es> writes

>You must try
> cs.style = WS_OVERLAPPED & ~WS_CAPTION
> cs.style = WS_DLGFRAME & ~WS_CAPTION.

That won't work. An "overlapped" window *always* has a caption. Only
"popup" or "child" windows can be created with no caption.

Chris

----------------------------------------------------------------
Chris Marriott, Microsoft Certified Solution Developer.
SkyMap Software, U.K. e-mail: ch...@skymap.com
Visit our web site at http://www.skymap.com

Naveed Zafar

unread,
Sep 18, 1997, 3:00:00 AM9/18/97
to

It's easy take a look at the clock sample code on the MSVC 1.5x or 4.x CD.
Here is the code fragment anyway,


void NEAR PASCAL SetMenuBar( HWND hWnd )
{
static DWORD wID;
DWORD dwStyle;

dwStyle = GetWindowLong( hWnd, GWL_STYLE );
if( ClockDisp.bNoTitle ) {
/* remove caption & menu bar, etc. */
dwStyle &= ~(WS_DLGFRAME | WS_SYSMENU |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX );
wID = SetWindowLong( hWnd, GWL_ID, 0 );
}
else {
/* put menu bar & caption back in */
dwStyle = WS_TILEDWINDOW | dwStyle;
SetWindowLong( hWnd, GWL_ID, wID );
}
SetWindowLong( hWnd, GWL_STYLE, dwStyle );
SetWindowPos( hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
SWP_NOZORDER | SWP_FRAMECHANGED );
ShowWindow( hWnd, SW_SHOW );
}


Chris Marriott <ch...@chrism.demon.co.uk> wrote in article
<HEaoNXAw...@chrism.demon.co.uk>...

0 new messages