Skip to content

Instantly share code, notes, and snippets.

@ZachNo
Created June 6, 2019 01:01
Show Gist options
  • Save ZachNo/191daf386dca7c1d3e2a760e8889b2f9 to your computer and use it in GitHub Desktop.
Save ZachNo/191daf386dca7c1d3e2a760e8889b2f9 to your computer and use it in GitHub Desktop.
AutoHotkey script to switch monitors through hotkey for XP-PEN Artist 22HD which uses tabcfg.exe
monitor = 1
hLibModule := DllCall("LoadLibrary", "Str", "WinTab32.dll", "Ptr")
if(hLibModule == 0) {
MsgBox Failed to load Wintab32.dll!
}
SetMapMonitorStateProc := DllCall("GetProcAddress", "Ptr", hLibModule, "AStr", "TDSetMapMonitorState", "Ptr")
if(SetMapMonitorStateProc == 0) {
MsgBox Failed to get address of TDSetMapMonitorState!
}
OpenTabletDeviceProc := DllCall("GetProcAddress", "Ptr", hLibModule, "AStr", "OpenTabletDevice", "Ptr")
if(OpenTabletDeviceProc == 0) {
MsgBox Failed to get address of OpenTabletDevice!
}
openTabletDeviceReturn := DllCall(OpenTabletDeviceProc, "Int", 0, "Int")
^+F1::
DllCall(SetMapMonitorStateProc, "Int", openTabletDeviceReturn, "Int", monitor)
if(monitor == 1) {
monitor = 2
} else {
monitor = 1
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment