Skip to content

Instantly share code, notes, and snippets.

@gyakoo
Forked from robert-nix/test.cpp
Last active February 6, 2017 17:49
Show Gist options
  • Save gyakoo/b78afdd94f7cff54a7db6c67cdd9fae6 to your computer and use it in GitHub Desktop.
Save gyakoo/b78afdd94f7cff54a7db6c67cdd9fae6 to your computer and use it in GitHub Desktop.
// lib /def:user32.def
// cl /O2 test.cpp /link user32.lib
#include <Windows.h>
#include <stdio.h>
struct PrecisionTouchPadConfig {
BYTE LegacyParams[3];
BOOL LoadedSettings;
// 0: No delay (always on)
// 1: Short delay
// 2: Medium delay (default)
// 3: Long delay
// 4: Turn off taps
DWORD AAPThreshold;
// 0001: PTPEnabled
// 0004: EnableEdgy
// 0008: ScrollDirection
// 0080: LeaveOnWithMouse
// 0100: RightClickZoneEnabled
// 0200: TapAndDrag
// 0400: IsTPActive
// 0800: IsMouseConnected
DWORD Flags;
};
extern "C" BOOL __stdcall UserGetPrecisionTouchPadConfiguration(PrecisionTouchPadConfig *config);
extern "C" BOOL __stdcall UserSetPrecisionTouchPadConfiguration(PrecisionTouchPadConfig *config);
int main() {
PrecisionTouchPadConfig config = {0};
// Must be 0 or 1 for GetPrecisionTouchPadConfiguration to return data.
config.LoadedSettings = 1;
BOOL getSuccess = UserGetPrecisionTouchPadConfiguration(&config);
printf("getSuccess = %d\n LegacyParams=%02x%02x%02x\n LoadedSettings=%02x\n AAPThreshold=%d\n Flags=%08x\n",
getSuccess,
config.LegacyParams[0], config.LegacyParams[1], config.LegacyParams[2],
config.LoadedSettings, config.AAPThreshold, config.Flags);
if (getSuccess) {
config.AAPThreshold = 0;
BOOL setSuccess = UserSetPrecisionTouchPadConfiguration(&config);
printf("setSuccess = %d\n", setSuccess);
}
return 0;
}
LIBRARY user32
EXPORTS
UserGetPrecisionTouchPadConfiguration @2548
UserSetPrecisionTouchPadConfiguration @2549
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment