Created
April 23, 2019 07:55
-
-
Save davidedg/8f74f1a2733ab255db6afbff8b263b64 to your computer and use it in GitHub Desktop.
WM_SETTINGCHANGE in Powershell (https://www.angryadmin.co.uk/?p=855)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (-not ("win32.nativemethods" -as [type])) { | |
add-type -Namespace Win32 -Name NativeMethods -MemberDefinition @" | |
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
public static extern IntPtr SendMessageTimeout( | |
IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, | |
uint fuFlags, uint uTimeout, out UIntPtr lpdwResult); | |
"@ | |
} | |
$HWND_BROADCAST = [intptr]0xffff; | |
$WM_SETTINGCHANGE = 0x1a; | |
$result = [uintptr]::zero | |
[win32.nativemethods]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE,[uintptr]::Zero, "Environment", 2, 5000, [ref]$result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment