Hi @Kumar, Amit - Dell Team , Welcome to Microsoft Q&A,
If you want to use C# to modify the registry, you can try to useRegistry.GetValue(String, String, Object) Method.
To modify the registry using C# and enable/disable the three- and four-finger touch gestures without requiring a machine restart, you can use the Microsoft.Win32 namespace. A similar example code is:
using System;
using Microsoft.Win32;
using System.Runtime.InteropServices;
class Program
{
// Define the constants for SPI_SETGESTURE (touch gestures)
private const uint SPI_SETGESTURE = 0x009B;
private const uint SPIF_SENDCHANGE = 0x02;
// Define the flags for touch gestures
private const uint GESTURE_ENABLE = 1;
private const uint GESTURE_DISABLE = 0;
// Import the SystemParametersInfo function from user32.dll
[DllImport("user32.dll", SetLastError = true)]
private static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
static void Main(string[] args)
{
// Modify the registry to enable/disable touch gestures
ModifyTouchGestureSettings(GESTURE_ENABLE); // Change this to GESTURE_DISABLE if you want to disable
// Notify the system about the change
SystemParametersInfo(SPI_SETGESTURE, 0, IntPtr.Zero, SPIF_SENDCHANGE);
Console.WriteLine("Touch gesture settings updated.");
}
// Function to modify the registry settings
static void ModifyTouchGestureSettings(uint setting)
{
// Registry key path
const string keyPath = @"HKEY_CURRENT_USER\Control Panel\Desktop";
// Registry value name
const string valueName = "TouchGestureSetting";
// Modify the registry value
Registry.SetValue(keyPath, valueName, setting, RegistryValueKind.DWord);
}
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.