Click to See Complete Forum and Search --> : Window with no border


Zeddy2
September 22nd, 2005, 07:04 AM
Hi,

I have odd problem with win32 UI. I want to create window with no border or titlebar, for splash screen or similar.

So I create window like this:

HWND hWnd = CreateWindowEx(WS_EX_NOACTIVATE, lpszClassName, lpszClassName,
WS_POPUPWINDOW, 0, 0, 1, 1, NULL, NULL, wc.hInstance, NULL );

This creates window with 1pixel black border all way round. Okay, that's odd. So I handle WM_NCPAINT:

switch( msg )
{
case WM_NCPAINT:
break;
<blah...>

Now I get window with no border on left and bottom, but 1 pixel black border on right and top sides!!!

Anyone explain why I not able to get borderless window?

ovidiucucu
September 22nd, 2005, 07:48 AM
WS_POPUPWINDOW is a composite style that includes WS_BORDER.
It is defined as follows:
#define WS_POPUPWINDOW (WS_POPUP | \
WS_BORDER | \
WS_SYSMENU)
So if you want a window with no border, replace WS_POPUPWINDOW with WS_POPUP style.

NOTE: no need to handle WM_NCPAINT.

Zeddy2
September 22nd, 2005, 12:55 PM
Ahh yes you very smart :) I didn't see silly bug for looking, my old eyes need new glasses ;) POPUPWINDOW looks too close to POPUP for me ;)