Jump to content

Recommended Posts

Posted

Hi, thank you in advance for any reply.

Is there any way to retrieve the Mica colors Windows 11 adds?

I mean get them as hex color values.

Maybe with _WinAPI_GetSysColor, dwmapi, DwmGetWindowAttribute?

Somehow? I wouldn't want to make a screenshot of windows 11 explorer and get it with a scrren color picker from its titlebar.

There must be a better way.

https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmgetwindowattribute

https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/apply-mica-win32

Thank you again in advance for any reply.

Posted

From what I've found you can gey it with DWMWA_SYSTEMBACKDROP_TYPE with DwmGetWindowAttribute

DWMWA_SYSTEMBACKDROP_TYPE
Use with DwmGetWindowAttribute or DwmSetWindowAttribute. Retrieves or specifies the system-drawn backdrop material of a window, including behind the non-client area. The pvAttribute parameter points to a value of type DWM_SYSTEMBACKDROP_TYPE.
 

https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute

 

If someone knows more about how to call dwmapi with that attribute, please let me know.

Thank you again in advance for any reply.

Posted (edited)
Global Const $DWMWA_SYSTEMBACKDROP_TYPE = 38

$tResult = DllStructCreate('int DWM_SYSTEMBACKDROP_TYPE;')
$hWin = WinGetHandle('[ACTIVE]')    ; Change with your window handle
DllCall('Dwmapi.dll', 'long', 'DwmGetWindowAttribute', 'hwnd', $hWin, 'dword', $DWMWA_SYSTEMBACKDROP_TYPE, 'ptr', DllStructGetPtr($tResult), 'int', DllStructGetSize($tResult))

ConsoleWrite('DWM_SYSTEMBACKDROP_TYPE: ' & $tResult.DWM_SYSTEMBACKDROP_TYPE & @CRLF)

Possible results:

  0 - DWMSBT_AUTO
  1 - DWMSBT_NONE
  2 - DWMSBT_MAINWINDOW
  3 - DWMSBT_TRANSIENTWINDOW
  4 - DWMSBT_TABBEDWINDOW

 

Or simply use _WinAPI_DwmGetWindowAttribute().

Edited by Andreik

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...