Skip to content

Instantly share code, notes, and snippets.

@downloadpizza
Created November 15, 2021 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save downloadpizza/bc439e4fa998ab064cf41d4cd42105e1 to your computer and use it in GitHub Desktop.
Save downloadpizza/bc439e4fa998ab064cf41d4cd42105e1 to your computer and use it in GitHub Desktop.
A simple example to set and get ClickLockState
static bool GetClickClock()
{
const uint getMouseCl = 0x101E;
bool res = true;
uint time = 0;
if(!PInvoke.SystemParametersInfo(getMouseCl, time, ref res, 0))
{
throw new Win32Exception();
}
return res;
}
static void SetClickClock(bool value)
{
const uint setMouseCL = 0x101F;
if (!PInvoke.SystemParametersInfo(setMouseCL, 0, value, 0))
{
throw new Win32Exception();
}
}
public class PInvoke
{
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam , ref bool pvParam, uint fWinIni);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, bool pvParam, uint fWinIni);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment