-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdemo1.ps1
More file actions
29 lines (19 loc) · 991 Bytes
/
demo1.ps1
File metadata and controls
29 lines (19 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Source: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
$typeDefinition = '
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "SystemParametersInfo")]
public static extern bool SetSystemParametersInfoBool(
int uiAction, int uiParam, bool lpvParam, int fuWinIni);
'
Add-Type -Name 'User' -Namespace 'Win32' -Language CSharp -MemberDefinition $typeDefinition
# Write the new setting to the user profile, and broadcasts the WM_SETTINGCHANGE message
$winIni = 3
$mouseTrails = 0x005D
# Turn mouse trails on
[Win32.User]::SetSystemParametersInfoBool($mouseTrails, 10, 0, $winIni)
# Turn them back off
[Win32.User]::SetSystemParametersInfoBool($mouseTrails, 0, 0, $winIni)
$dragFullWindows = 0x0025
# Turn full window dragging on
[Win32.User]::SetSystemParametersInfoBool($dragFullWindows, $true, 0, $winIni)
# Turn it off
[Win32.User]::SetSystemParametersInfoBool($dragFullWindows, $false, 0, $winIni)