@Tong Xu - MSFT thank you for trying it!
Indeed adding WS_POPUP
the white border doesn't appear, however the shadow is also gone and the window cant be minimized anymore.
I have been able to change that border color using the undoc SetWindowCompositionAttribute
, however i couldn't get it fully transparent:
const MARGINS shadow = { 1, 1, 1, 1 };
DwmExtendFrameIntoClientArea(mainwindow_hWnd, &shadow);
struct ACCENTPOLICY
{
int nAccentState;
int nFlags;
int nColor;
int nAnimationId;
};
struct WINCOMPATTRDATA
{
int na;
PVOID pd;
ULONG ul;
};
/*
typedef enum _ACCENT_STATE {
ACCENT_DISABLED = 0,
ACCENT_ENABLE_GRADIENT = 1,
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
ACCENT_ENABLE_BLURBEHIND = 3,
ACCENT_INVALID_STATE = 4
} ACCENT_STATE;
typedef struct _ACCENT_POLICY {
ACCENT_STATE AccentState;
DWORD AccentFlags;
DWORD GradientColor;
DWORD AnimationId;
} ACCENT_POLICY;
_ACCENT_FLAGS{
DrawLeftBorder = 0x20,
DrawTopBorder = 0x40,
DrawRightBorder = 0x80,
DrawBottomBorder = 0x100,
DrawAllBorders = (DrawLeftBorder | DrawTopBorder | DrawRightBorder | DrawBottomBorder)
}
*/
const HINSTANCE hm = LoadLibrary(L"user32.dll");
if (hm)
{
typedef BOOL(WINAPI* pSetWindowCompositionAttribute)(HWND, WINCOMPATTRDATA*);
const pSetWindowCompositionAttribute SetWindowCompositionAttribute = (pSetWindowCompositionAttribute)GetProcAddress(hm, "SetWindowCompositionAttribute");
if (SetWindowCompositionAttribute)
{
ACCENTPOLICY policy = { 2, 0, 0x01000000, 0 };
WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) }; // WCA_ACCENT_POLICY=19
SetWindowCompositionAttribute(mainwindow_hWnd, &data);
DWORD err = GetLastError();
qDebug() << "err: " << err;
}
FreeLibrary(hm);
}
Could you please show a minimal, reproducible sample without private information?
I didn't share the full code because the window im working is being built using the Qt framework, I'm editing these things by handling into her DefWindowProc
.
I wonder if you could share the code you've used, so i could try get it working on it and after replicate on the Qt window.
(I'm replying as an answer because i wasn't allowed to do on comment as it 'exceeded maximum characters')