Win32 API provides many styles for window creating and I'm looking for a style that can remove a one-pixel border from the window that I created with this code:

DWORD dwExtStyle = 0;
DWORD dwStyle = WS_POPUPWINDOW;

    m_hWnd = CreateWindowEx(
    dwExtStyle,
    className,
    windowName,
    dwStyle,
    300,
    300,
    100,
    100,
    NULL,
    NULL,
    hInstance,
    NULL);

ShowWindow(m_hWnd, SW_SHOW);

and I got the result:

enter image description here

What combination of flags can remove the black border from the window.

有帮助吗?

解决方案

Just use WS_POPUP instead of WS_POPUPWINDOW.

The macro WS_POPUPWINDOW is actually a set of flags:

#define WS_POPUPWINDOW (WS_BORDER | WS_POPUP | WS_SYSMENU)

The WS_BORDER flag is the one responsible of your black square.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top