Just to add some my attempts to "update the registry" after making the change.
Here it is a ps (power shell) script that I tried. It does the change I need in the registry (but that's the easy part), yet it fails in updating immediately the new status to the whole system. I hope someone can help.
# Change the registry key
Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\PrecisionTouchPad" -Name "PanEnabled" -Value 0
# Define the SendNotifyMessageW function
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Settings {
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool SendNotifyMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
public const int WM_SETTINGCHANGE = 0x1A;
}
"@
# Send the WM_SETTINGCHANGE message to all top-level windows with the "PrecisionTouchPad" parameter
$changeString = [System.Runtime.InteropServices.Marshal]::StringToHGlobalUni("PrecisionTouchPad")
[Settings]::SendNotifyMessage([Settings]::HWND_BROADCAST, [Settings]::WM_SETTINGCHANGE, [IntPtr]::Zero, $changeString)
# Clean up the allocated string memory
[System.Runtime.InteropServices.Marshal]::FreeHGlobal($changeString)