musicstashall Posted May 25, 2017 Posted May 25, 2017 Help implement this function in AutoIt. Example below: expandcollapse popup; =============================================================================================================================== ; Make the windows 10 taskbar translucent (blur) ; https://autohotkey.com/boards/viewtopic.php?f=6&t=26752 ; =============================================================================================================================== /* TaskBar_SetAttr(option, color) option -> 0 = off 1 = gradient (+color) 2 = transparent (+color) 3 = blur color -> ABGR (alpha | blue | green | red) 0xffd7a78f */ TaskBar_SetAttr(accent_state := 0, gradient_color := "0x01000000") { static init, hTrayWnd, ver := DllCall("GetVersion") & 0xff < 10 static pad := A_PtrSize = 8 ? 4 : 0, WCA_ACCENT_POLICY := 19 if !(init) { if (ver) throw Exception("Minimum support client: Windows 10", -1) if !(hTrayWnd := DllCall("user32\FindWindow", "str", "Shell_TrayWnd", "ptr", 0, "ptr")) throw Exception("Failed to get the handle", -1) init := 1 } accent_size := VarSetCapacity(ACCENT_POLICY, 16, 0) NumPut((accent_state > 0 && accent_state < 4) ? accent_state : 0, ACCENT_POLICY, 0, "int") if (accent_state >= 1) && (accent_state <= 2) && (RegExMatch(gradient_color, "0x[[:xdigit:]]{8}")) NumPut(gradient_color, ACCENT_POLICY, 8, "int") VarSetCapacity(WINCOMPATTRDATA, 4 + pad + A_PtrSize + 4 + pad, 0) && NumPut(WCA_ACCENT_POLICY, WINCOMPATTRDATA, 0, "int") && NumPut(&ACCENT_POLICY, WINCOMPATTRDATA, 4 + pad, "ptr") && NumPut(accent_size, WINCOMPATTRDATA, 4 + pad + A_PtrSize, "uint") if !(DllCall("user32\SetWindowCompositionAttribute", "ptr", hTrayWnd, "ptr", &WINCOMPATTRDATA)) throw Exception("Failed to set transparency / blur", -1) return true } ; =============================================================================================================================== TaskBar_SetAttr(1, 0xc1e3c791) ; <- Set gradient with color 0xd7a78f ( rgb = 0x91c7e3 ) and alpha 0xc1 sleep 3000 TaskBar_SetAttr(2, 0xa1e3c791) ; <- Set transparent with color 0xd7a78f ( rgb = 0x91c7e3 ) and alpha 0xa1 sleep 3000 TaskBar_SetAttr(2) ; <- Set transparent sleep 3000 TaskBar_SetAttr(3) ; <- Set blur sleep 3000 TaskBar_SetAttr(0) ; <- Set standard value ExitApp /* Since clicking on Win-Start will reset the taskbar, it will be the best solution to use a SetTimer with x ms to set the Attribute #NoEnv #Persistent #SingleInstance Force SetBatchLines -1 SetTimer, UPDATE_TASKBAR, 100 return UPDATE_TASKBAR: TaskBar_SetAttr(3) return */ ; =============================================================================================================================== /* Shell_TrayWnd -> Main TaskBar Shell_SecondaryTrayWnd -> 2nd TaskBar (on multiple monitors) */ /* C++ ========================================================================================================================== BOOL GetWindowCompositionAttribute( _In_ HWND hWnd, _Inout_ WINDOWCOMPOSITIONATTRIBDATA* pAttrData ); BOOL SetWindowCompositionAttribute( _In_ HWND hWnd, _Inout_ WINDOWCOMPOSITIONATTRIBDATA* pAttrData ); typedef struct _WINDOWCOMPOSITIONATTRIBDATA { WINDOWCOMPOSITIONATTRIB Attrib; PVOID pvData; SIZE_T cbData; } WINDOWCOMPOSITIONATTRIBDATA; typedef enum _WINDOWCOMPOSITIONATTRIB { WCA_UNDEFINED = 0, WCA_NCRENDERING_ENABLED = 1, WCA_NCRENDERING_ENABLED = 1, WCA_NCRENDERING_POLICY = 2, WCA_TRANSITIONS_FORCEDISABLED = 3, WCA_ALLOW_NCPAINT = 4, WCA_CAPTION_BUTTON_BOUNDS = 5, WCA_NONCLIENT_RTL_LAYOUT = 6, WCA_FORCE_ICONIC_REPRESENTATION = 7, WCA_EXTENDED_FRAME_BOUNDS = 8, WCA_HAS_ICONIC_BITMAP = 9, WCA_THEME_ATTRIBUTES = 10, WCA_NCRENDERING_EXILED = 11, WCA_NCADORNMENTINFO = 12, WCA_EXCLUDED_FROM_LIVEPREVIEW = 13, WCA_VIDEO_OVERLAY_ACTIVE = 14, WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15, WCA_DISALLOW_PEEK = 16, WCA_CLOAK = 17, WCA_CLOAKED = 18, WCA_ACCENT_POLICY = 19, WCA_FREEZE_REPRESENTATION = 20, WCA_EVER_UNCLOAKED = 21, WCA_VISUAL_OWNER = 22, WCA_LAST = 23 } WINDOWCOMPOSITIONATTRIB; typedef struct _ACCENT_POLICY { ACCENT_STATE AccentState; DWORD AccentFlags; DWORD GradientColor; DWORD AnimationId; } ACCENT_POLICY; 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; _ACCENT_FLAGS { DrawLeftBorder = 0x20, DrawTopBorder = 0x40, DrawRightBorder = 0x80, DrawBottomBorder = 0x100, DrawAllBorders = (DrawLeftBorder | DrawTopBorder | DrawRightBorder | DrawBottomBorder) } ============================================================================================================================== */
Danyfirex Posted May 25, 2017 Posted May 25, 2017 (edited) Check this. Probably not what you need but it's a good start. Saludos Edited May 25, 2017 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
musicstashall Posted May 25, 2017 Author Posted May 25, 2017 I do not need blurring, but apply the color to the taskbar.
Danyfirex Posted May 25, 2017 Posted May 25, 2017 ¬¬ I told Probably not what you need but it's a good start. I don't get payed here for helping.... bye Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
anthonyjr2 Posted May 25, 2017 Posted May 25, 2017 Most of us don't know anything about AHK, so its source code probably won't help that much. It would have to be rewritten from scratch for use in AutoIt, and a lot of us don't really have incentive to do that. UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=
Danyfirex Posted May 25, 2017 Posted May 25, 2017 It's pretty easy to covert that. But his decency makes me got angry Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
musicstashall Posted May 25, 2017 Author Posted May 25, 2017 Here, probably, all sense consists in the given reference to user32.dll: DllCall("user32\SetWindowCompositionAttribute", ptr, $hTrayWnd, ptr, $WINCOMPATTRDATA) $WINCOMPATTRDATA — probably a variable with some value. In function, the calculation of this value. I need only set the color for the taskbar. Can play with values?
musicstashall Posted May 25, 2017 Author Posted May 25, 2017 Or so: DllCall('user32.dll', 'uint', 'SetWindowCompositionAttribute', 'ptr', 16) How to correctly refer to user32 ??
UEZ Posted May 25, 2017 Posted May 25, 2017 Look here: _WinAPI_DwmEnableBlurBehindWindow10(WinGetHandle("[CLASS:Shell_TrayWnd]")) will do the trick. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
anthonyjr2 Posted May 25, 2017 Posted May 25, 2017 @UEZ, @Danyfirex posted that earlier but the OP said it wasn't what he was looking for. UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=
musicstashall Posted May 25, 2017 Author Posted May 25, 2017 The problem is solved! Thanks Danyfirex Local $hWnd = WinGetHandle('[CLASS:Shell_TrayWnd]') Local $tAccentPolicy = DllStructCreate("int AccentState; int AccentFlags; int GradientColor; int AnimationId") Local $tAttrData = DllStructCreate("dword Attribute; ptr DataBuffer; ulong Size") $tAccentPolicy.AccentState = True ? 2 : 0 $tAttrData.Attribute = 19 ; WCA_ACCENT_POLICY $tAttrData.DataBuffer = DllStructGetPtr($tAccentPolicy) $tAttrData.Size = DllStructGetSize($tAccentPolicy) Local $aResult = DllCall("user32.dll", "bool", "SetWindowCompositionAttribute", "hwnd", $hWnd, "ptr", DllStructGetPtr($tAttrData))
Danyfirex Posted May 26, 2017 Posted May 26, 2017 You're welcome Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
musicstashall Posted May 27, 2017 Author Posted May 27, 2017 All is well, but not in everything. The function is for windows, not for the taskbar. The color for colorization is taken from the components _WinAPI_DwmSetColorizationParameters, so the task panel is painted in the brightest color, like the windows, and its color is much darker L = 54. You can agree with this, but after dyeing the taskbar, the color crash and set to default, which was before, once you hit the "Start" button.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now