Created
November 15, 2021 12:43
-
-
Save downloadpizza/bc439e4fa998ab064cf41d4cd42105e1 to your computer and use it in GitHub Desktop.
A simple example to set and get ClickLockState
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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