Discussion:
I want to create a very simple window without a title bar
(too old to reply)
Angus Comber
2004-05-16 19:51:58 UTC
Permalink
Hello

I want to create a simple window which will be a small rectangle with some
text. I don't want a minimize box, maximise, resize, or a title bar.

I have tried something like this:

WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = NULL; // LoadIcon(hInstance, (LPCTSTR)IDI_WINMAINTEST);
wcex.hCursor = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_IOHAND));
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = NULL; // LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
RegisterClassEx(&wcex);
hWnd = CreateWindow(szWindowClass, NULL, WS_DLGFRAME | WS_BORDER ,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

But I still get the Title bar.

How can I do this? Do I perhaps need to create a dialog window rather than
a normal window?

Angus Comber
***@NOSPAMiteloffice.com
Tim Robinson
2004-05-16 20:02:10 UTC
Permalink
Angus Comber wrote:
[...]
Post by Angus Comber
hWnd = CreateWindow(szWindowClass, NULL, WS_DLGFRAME | WS_BORDER ,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
But I still get the Title bar.
How can I do this? Do I perhaps need to create a dialog window
rather than a normal window?
You should be OK if you add WS_POPUP there.
--
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/
Angus Comber
2004-05-16 20:18:28 UTC
Permalink
I tried:

hWnd = CreateWindow(szWindowClass, NULL, WS_DLGFRAME | WS_BORDER | WS_POPUP
, 0, 0, 300, 300, NULL, NULL, hInstance, NULL);

But still get Title bar.

Angus
Post by Tim Robinson
[...]
Post by Angus Comber
hWnd = CreateWindow(szWindowClass, NULL, WS_DLGFRAME | WS_BORDER ,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
But I still get the Title bar.
How can I do this? Do I perhaps need to create a dialog window
rather than a normal window?
You should be OK if you add WS_POPUP there.
--
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/
Angus Comber
2004-05-16 20:30:25 UTC
Permalink
This worked:

hWnd = CreateWindow(szWindowClass, NULL, WS_POPUP | WS_DLGFRAME, 20, 20,
300, 300, NULL, NULL, hInstance, NULL);

If I use the WS_BORDER style the Title bar appears again.

Angus
Post by Angus Comber
hWnd = CreateWindow(szWindowClass, NULL, WS_DLGFRAME | WS_BORDER | WS_POPUP
, 0, 0, 300, 300, NULL, NULL, hInstance, NULL);
But still get Title bar.
Angus
Post by Tim Robinson
[...]
Post by Angus Comber
hWnd = CreateWindow(szWindowClass, NULL, WS_DLGFRAME | WS_BORDER ,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
But I still get the Title bar.
How can I do this? Do I perhaps need to create a dialog window
rather than a normal window?
You should be OK if you add WS_POPUP there.
--
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/
Raymond Chen
2004-05-17 06:27:00 UTC
Permalink
Look at the definition for WS_CAPTION.

#define WS_CAPTION 0x00C00000L /* WS_BORDER |
WS_DLGFRAME */
#define WS_BORDER 0x00800000L
#define WS_DLGFRAME 0x00400000L

That should explain it.

On Sun, 16 May 2004 21:30:25 +0100, "Angus Comber"
Post by Angus Comber
hWnd = CreateWindow(szWindowClass, NULL, WS_POPUP | WS_DLGFRAME, 20, 20,
300, 300, NULL, NULL, hInstance, NULL);
If I use the WS_BORDER style the Title bar appears again.
r***@pen_fact.com
2004-05-17 20:56:15 UTC
Permalink
On Sun, 16 May 2004 20:51:58 +0100, "Angus Comber"
Post by Angus Comber
Hello
I want to create a simple window which will be a small rectangle with some
text. I don't want a minimize box, maximise, resize, or a title bar.
Perhaps:
WS_BORDER | WS_VISIBLE | WS_CHILD

I use that for a dialog box that I'm using inside another dialog box.
The result looks like a child window with a small border. No title
bar, system menu, or any such.
Post by Angus Comber
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = NULL; // LoadIcon(hInstance, (LPCTSTR)IDI_WINMAINTEST);
wcex.hCursor = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_IOHAND));
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = NULL; // LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
RegisterClassEx(&wcex);
hWnd = CreateWindow(szWindowClass, NULL, WS_DLGFRAME | WS_BORDER ,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
But I still get the Title bar.
How can I do this? Do I perhaps need to create a dialog window rather than
a normal window?
Angus Comber
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

Continue reading on narkive:
Loading...