Skip to content

Commit f6463fc

Browse files
committed
Merge remote-tracking branch 'origin/patch-2' into patch-1
2 parents e63f408 + 53e2b4f commit f6463fc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

stable/ChangeWindowsAppTheme.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,24 @@ if (Test-Path $registryPath)
77
{
88
New-ItemProperty -Path $registryPath -Name "AppsUseLightTheme" -Value $dwordValue -PropertyType DWORD -Force | Out-Null
99
}
10+
11+
# Call Windows theme refresh
12+
Add-Type -TypeDefinition @"
13+
using System;
14+
using System.Runtime.InteropServices;
15+
16+
public class Win32Utils {
17+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
18+
public static extern int SendMessageTimeout(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam, int fuFlags, int uTimeout, out IntPtr lpdwResult);
19+
}
20+
"@ -PassThru
21+
22+
$HWND_BROADCAST = [IntPtr]::Zero -bor 0xFFFF
23+
$WM_SETTINGCHANGE = 0x1A
24+
$SPI_SETCLIENTAREAANIMATION = 0x1043
25+
26+
$param = [System.Runtime.InteropServices.Marshal]::StringToHGlobalUni("ImmersiveColorSet")
27+
28+
$null = [Win32Utils]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [IntPtr]::Zero, $param, 2, 5000, [ref]([IntPtr]::Zero))
29+
30+
[System.Runtime.InteropServices.Marshal]::FreeHGlobal($param)

0 commit comments

Comments
 (0)