Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/patch-2' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
KrakenByte27 committed Feb 26, 2025
2 parents e63f408 + 53e2b4f commit f6463fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/ChangeWindowsAppTheme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,24 @@ if (Test-Path $registryPath)
{
New-ItemProperty -Path $registryPath -Name "AppsUseLightTheme" -Value $dwordValue -PropertyType DWORD -Force | Out-Null
}

# Call Windows theme refresh
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Win32Utils {
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern int SendMessageTimeout(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam, int fuFlags, int uTimeout, out IntPtr lpdwResult);
}
"@ -PassThru

$HWND_BROADCAST = [IntPtr]::Zero -bor 0xFFFF
$WM_SETTINGCHANGE = 0x1A
$SPI_SETCLIENTAREAANIMATION = 0x1043

Check warning

Code scanning / PSScriptAnalyzer

The variable 'SPI_SETCLIENTAREAANIMATION' is assigned but never used. Warning

The variable 'SPI_SETCLIENTAREAANIMATION' is assigned but never used.

$param = [System.Runtime.InteropServices.Marshal]::StringToHGlobalUni("ImmersiveColorSet")

$null = [Win32Utils]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [IntPtr]::Zero, $param, 2, 5000, [ref]([IntPtr]::Zero))

[System.Runtime.InteropServices.Marshal]::FreeHGlobal($param)

0 comments on commit f6463fc

Please sign in to comment.