Skip to content

Instantly share code, notes, and snippets.

@sir-pinecone
Forked from robert-nix/test.cpp
Last active February 6, 2017 23:02
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 sir-pinecone/37e1b018de2d00080a835efd4f644444 to your computer and use it in GitHub Desktop.
Save sir-pinecone/37e1b018de2d00080a835efd4f644444 to your computer and use it in GitHub Desktop.
LIBRARY user32
EXPORTS
UserGetPrecisionTouchPadConfiguration @2548
UserSetPrecisionTouchPadConfiguration @2549
// 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment