I have a program that renders to a D3D11 swapchain created with IDXGIFactory2::CreateSwapChainForHwnd
. It clears the swap chain to a particular color, specifically green, and draws a textured rectangle. Following the guide at https://learn.microsoft.com/en-us/windows/desktop/dwm/customframe, I extended the window caption downward using DwmExtendFrameIntoClientArea
and I extended the client area to the entire window by handling the WM_NCCALCSIZE
message. When the swap chain is presented, the contents of the swap chain buffer is drawn on top of the window, completely covering the DWM-drawn glass frame and caption buttons. How can I leave regions of the glass frame and caption buttons to be drawn by DWM while still drawing in the window frame using D3D11?
I have already tried to clear the RenderTargetView
to a color of {0.0f, 0.0f, 0.0f, 0.0f}
with ID3D11DeviceContext::ClearRenderTargetView
but the alpha component appears to be ignored. I've tried to specify DXGI_ALPHA_MODE_STRAIGHT
and DXGI_ALPHA_MODE_PREMULTIPLIED
in the AlphaMode member of the DXGI_SWAP_CHAIN_DESC1
used to create the swap chain, but it crashes because alpha-blended swapchains must be created by CreateSwapChainForComposition
or CreateSwapChainForCoreWindow
. Those functions are not viable since I would like to support Windows 7.
Another thing I've tried is creating a blend state and making parts of the texture transparent. All this does is blend the transparent parts of texture with the clear color. Nothing is getting rendered by DWM though.