AutoHotInterception/Lib/AutoHotInterception.ahk

39 lines
963 B
AutoHotkey
Raw Normal View History

2018-03-06 19:53:04 +00:00
#include %A_LineFile%\..\CLR.ahk
2018-03-28 19:39:29 +00:00
class AutoHotInterception {
__New(cls := "Manager"){
dllName := "AutoHotInterception.dll"
dllFile := A_LineFile "\..\" dllName
2018-03-29 14:28:54 +00:00
hintMessage := "Try right-clicking lib\" dllName ", select Properties, and if there is an 'Unblock' checkbox, tick it"
2018-03-28 19:39:29 +00:00
if (!FileExist(dllFile)){
2018-03-29 14:28:54 +00:00
MsgBox % "Unable to find " dllName ", exiting..."
2018-03-28 19:39:29 +00:00
ExitApp
}
asm := CLR_LoadLibrary(dllFile)
try {
this.Interception := asm.CreateInstance("AutoHotInterception." cls)
}
catch {
2018-03-29 14:28:54 +00:00
MsgBox % dllName " failed to load`n`n" hintMessage
2018-03-28 19:39:29 +00:00
ExitApp
}
if (this.Interception.OkCheck() != "OK"){
2018-03-29 14:28:54 +00:00
MsgBox % dllName " loaded but check failed!`n`n" hintMessage
2018-03-28 19:39:29 +00:00
ExitApp
}
2018-03-06 19:53:04 +00:00
}
2018-03-28 19:39:29 +00:00
GetInstance(){
return this.Interception
2018-03-06 19:53:04 +00:00
}
2018-03-28 19:39:29 +00:00
GetDeviceList(){
DeviceList := {}
arr := this.Interception.GetDeviceList()
for v in arr {
DeviceList[v.id] := { ID: v.id, VID: v.vid, PID: v.pid, IsMouse: v.IsMouse }
}
return DeviceList
2018-03-06 19:53:04 +00:00
}
}