ARTICLE AD BOX
Applications are updated with new settings via the WM_SETTINGCHANGE window message. While it's possible to do that yourself, there is an official way to do all of this via SystemParametersInfo.
You need the following definitions:
[DllImport("user32.dll", SetLastError = true, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool SystemParametersInfoW( uint uiAction, uint uiParam, ref TOUCHPAD_PARAMETERS_V1 pvParam, uint fWinIni); private const uint SPI_GETTOUCHPADPARAMETERS = 0x00AE; private const uint SPI_SETTOUCHPADPARAMETERS = 0x00AF; private const uint SPIF_UPDATEINIFILE = 0x01; private const uint SPIF_SENDCHANGE = 0x02; [StructLayout(LayoutKind.Sequential)] private struct TOUCHPAD_PARAMETERS_V1 { uint versionNumber = 1; public uint maxSupportedContacts; public LEGACY_TOUCHPAD_FEATURES legacyTouchpadFeatures; public TOUCHPAD_FLAGS1 flags1; public TOUCHPAD_FLAGS2 flags2; public TOUCHPAD_SENSITIVITY_LEVEL sensitivityLevel; public uint cursorSpeed; public uint feedbackIntensity; public uint clickForceSensitivity; public uint rightClickZoneWidth; public uint rightClickZoneHeight; } [Flags] private enum TOUCHPAD_FLAGS1 : uint { TouchpadPresent = 1u << 0, LegacyTouchpadPresent = 1u << 1, ExternalMousePresent = 1u << 2, TouchpadEnabled = 1u << 3, TouchpadActive = 1u << 4, FeedbackSupported = 1u << 5, ClickForceSupported = 1u << 6, } [Flags] private enum TOUCHPAD_FLAGS2 : uint { AllowActiveWhenMousePresent = 1u << 0, FeedbackEnabled = 1u << 1, TapEnabled = 1u << 2, TapAndDragEnabled = 1u << 3, TwoFingerTapEnabled = 1u << 4, RightClickZoneEnabled = 1u << 5, MouseAccelSettingHonored = 1u << 6, PanEnabled = 1u << 7, ZoomEnabled = 1u << 8, ScrollDirectionReversed = 1u << 9, } private enum LEGACY_TOUCHPAD_FEATURES { LEGACY_TOUCHPAD_FEATURE_NONE = 0x00000000, LEGACY_TOUCHPAD_FEATURE_ENABLE_DISABLE = 0x00000001, LEGACY_TOUCHPAD_FEATURE_REVERSE_SCROLL_DIRECTION = 0x00000004 } private enum TOUCHPAD_SENSITIVITY_LEVEL { TOUCHPAD_SENSITIVITY_LEVEL_MOST_SENSITIVE = 0x00000000, TOUCHPAD_SENSITIVITY_LEVEL_HIGH_SENSITIVITY = 0x00000001, TOUCHPAD_SENSITIVITY_LEVEL_MEDIUM_SENSITIVITY = 0x00000002, TOUCHPAD_SENSITIVITY_LEVEL_LOW_SENSITIVITY = 0x00000003, TOUCHPAD_SENSITIVITY_LEVEL_LEAST_SENSITIVE = 0x00000004 }Then get the current params, change the values you want and set back. The function sets the registry (if you use SPIF_UPDATEINIFILE or SPIF_SENDCHANGE) and fire a message (if you use SPIF_SENDCHANGE).
var touchParams = new TOUCHPAD_PARAMETERS_V1(); // get existing params if (!SystemParametersInfoW(SPI_GETTOUCHPADPARAMETERS, Marshal.SizeOf<TOUCHPAD_PARAMETERS_V1>(), ref touchParams, 0)) throw new Win32Exception(Marshal.GetLastPInvokeError()); touchParams.Flags2 |= TOUCHPAD_FLAGS2.TapEnabled; // set new params and fire message if (!SystemParametersInfoW(SPI_SETTOUCHPADPARAMETERS, Marshal.SizeOf<TOUCHPAD_PARAMETERS_V1>(), ref touchParams, SPIF_SENDCHANGE)) throw new Win32Exception(Marshal.GetLastPInvokeError());