Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 Location: Tampa, FL Thanks: 28 times Was thanked: 431 time(s) in 364 post(s)
|
(from a Discord user request, putting here for reference)This script will allow you to toggle the Windows Mouse ClickLock feature on/off. In your Global Actions > Load/Unload > Load tab, add this script: Code:if(!NativeModules.MouseClickLock)
{
var Int32T = host.typeOf(System.Int32);
var UInt32T = host.typeOf(System.UInt32);
var BooleanT = host.typeOf(System.Boolean);
var BooleanT_ref = host.typeOf(System.Boolean).MakeByRefType();
var mouseClickLockTB = sp.NativeModule().DefineType(
"MouseClickLock",
"Class,Public,SequentialLayout,Serializable"
);
mouseClickLockTB.DefinePInvokeMethod(
"SystemParametersInfo",
"user32.dll",
[UInt32T,UInt32T,BooleanT_ref,UInt32T],
Int32T,
"PreserveSig"
);
mouseClickLockTB.DefinePInvokeMethod(
"SystemParametersInfo",
"user32.dll",
[UInt32T,UInt32T,BooleanT,UInt32T],
Int32T,
"PreserveSig"
);
mouseClickLockTB.Create();
}
function ToggleClickLock() {
var SPI_GETMOUSECLICKLOCK = 0x101E;
var SPI_SETMOUSECLICKLOCK = 0x101F;
var SPIF_SENDCHANGE = 0x0002;
var mouseClickLocked = host.newVar(System.Boolean);
NativeModules.MouseClickLock.SystemParametersInfo(SPI_GETMOUSECLICKLOCK, 0, mouseClickLocked.ref, SPIF_SENDCHANGE);
NativeModules.MouseClickLock.SystemParametersInfo(SPI_SETMOUSECLICKLOCK, 0, !mouseClickLocked.value, SPIF_SENDCHANGE);
}
Then just call this wherever you want to toggle ClickLock on/off:
|
1 user thanked Rob for this useful post.
|
|