New features in WinAPI on Windows 11

With the release of the new operating system, Microsoft’s design priorities have changed – now the interface has animations, and in general it has become less sharp. In this article, I will share some of the tricks that I encountered while working with WinAPI.

All the options in this article appeared with the release of the assembly 22000. And are used by DWM by calling the function DwmSetWindowAttribute.

Making Mica

Mica design example from Microsft website
Mica design example from Microsft website

Mica is a new style in Windows 11 that has replaced Fluent. According to Microsoft, it was designed to give the user the best performance. Unlike its predecessor, Mica can be enabled in WinApi applications without special crutches.

This can be done using a variable that is not officially documented – DWMWA_MICA_EFFECT. She matters 1029.

Here’s how to use it in practice:

#define DWMWA_MICA_EFFECT DWORD(1029);	// Mica

int useMica = 1;
DwmSetWindowAttribute(hwnd, DWMWA_MICA_EFFECT, &useMica, sizeof(int));
Mica effect on WPF window
Mica effect on WPF window

Unfortunately, Microsoft has informed that this method will not work in future releases of Windows.

Therefore, starting from assembly 22523was replaced by another method, with a small bonus in the form of new styles:

const auto DWMSBT_DISABLE 				= 1 // Default
const auto DWMSBT_MAINWINDOW 			= 2 // Mica
const auto DWMSBT_TRANSIENTWINDOW = 3 // Acrylic
const auto DWMSBT_TABBEDWINDOW 		= 4 // Tabbed


The parameter has no restrictions on use, so it can be pulled on any window. (Microsoft took advantage of this and finally redesigned File Explorer a bit)

For C#, for example, there are several libraries aimed at simulating controls from Mica in WPF.

WPF application with Mica design
WPF application with Mica design

Change window color

Continuing the list of changes in Dwm… Next comes a small set of options for changing the color of the title bar, the text on it, and the borders of the window itself.

  • DWMWA_CAPTION_COLOR – Header color

  • DWMWA_TEXT_COLOR – Header text color

  • DWMWA_BORDER_COLOR – Window border color

Here is a small usage example:


auto caption = RGB(45, 80, 45);
auto text = RGB(20, 180, 180);
auto border = RGB(255, 0, 0);
DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &caption, sizeof(COLORREF));
DwmSetWindowAttribute(hwnd, DWMWA_TEXT_COLOR, &text, sizeof(COLORREF));
DwmSetWindowAttribute(hwnd, DWMWA_BORDER_COLOR, &border, sizeof(COLORREF));
Window colors example
Window colors example

As a result, such a designer’s nightmare can turn out …

By the way, this innovation has been used by the Telegram desktop client for a long time.

It is worth saying that before all these parameters appeared, you had to create your own window design, draw buttons, add WM_NCHITTEST message processing to it, and also solve problems with Aero animation … In general, life has become easier.

Window rounding

Don’t like the new rounded windows in Windows 11? Then Microsoft has a solution – parameter DWMWA_WINDOW_CORNER_PREFERENCE!

It has three whole meanings:


const auto DWMWCP_DONOTROUND = 1;		// Rectangular
const auto DWMWCP_ROUND = 2;				// Default
const auto DWMWCP_ROUNDSMALL = 3;		// Semi-rounded

Round Comparison: Square, Regular, Slightly Round
Round Comparison: Square, Regular, Slightly Round

This setting may have been added by Microsoft for personal use. After all, if you expand the window to half or a quarter of the screen, then its corners will also become square.


These are not all innovations in customizing the appearance of windows. “Behind the scenes” there were parameters for changing the thickness of the border, and mirroring the entire window. But these are very specific features that I decided not to talk about.

I hope this article will be useful for someone.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *