|
|
@ -4,82 +4,89 @@ SetWorkingDir, %A_ScriptDir% |
|
|
|
Gui +LastFound |
|
|
|
hWnd := WinExist() |
|
|
|
|
|
|
|
; OSC datatypes. Just for better readability, |
|
|
|
; you also just could use the numbers |
|
|
|
global oscTypeNone := 1 |
|
|
|
global oscTypeInt := 2 |
|
|
|
global oscTypeFloat := 4 |
|
|
|
global oscTypeAll := 0xffffffff |
|
|
|
|
|
|
|
stdout := FileOpen("tmp.log", "w") |
|
|
|
stdout.WriteLine("START") |
|
|
|
|
|
|
|
retOnMsg := OnMessage(0x1000, "msghandler") |
|
|
|
stdout.Write("OnMessage: ") |
|
|
|
stdout.WriteLine(retOnMsg) |
|
|
|
OnExit("exithandler") |
|
|
|
|
|
|
|
hModule := DllCall("LoadLibrary", "Str", "x64\Debug\OSC2AHK.dll", "Ptr") ; Avoids the need for DllCall() in the loop to load the library. |
|
|
|
stdout.Write("DLL handle: ") |
|
|
|
stdout.WriteLine(hModule) |
|
|
|
DllCall("LoadLibrary", "Str", "x64\Debug\OSC2AHK.dll", "Ptr") |
|
|
|
; ret := DllCall("OSC2AHK.dll\testMsg", UInt,hWnd, UInt,0x1000, int) |
|
|
|
|
|
|
|
; ret := DllCall("OSC2AHK.dll\testMsg", UInt,hWnd, UInt,0x1000) |
|
|
|
; stdout.WriteLine("DLL call:") |
|
|
|
; stdout.WriteLine(ret) |
|
|
|
OnMessage(0x1002, "msghandlerFloat") |
|
|
|
|
|
|
|
ret3 := DllCall("OSC2AHK.dll\open", UInt, hWnd, UInt, 7002) |
|
|
|
stdout.Write("DLL open: ") |
|
|
|
stdout.WriteLine(ret3) |
|
|
|
DllCall("OSC2AHK.dll\open", UInt, hWnd, UInt, 7002) |
|
|
|
|
|
|
|
ret2 := DllCall("OSC2AHK.dll\addListener", AStr, "/test", UInt, 0x1001, UInt, 1) |
|
|
|
retOnMsg := OnMessage(0x1001, "msghandler") |
|
|
|
stdout.Write("DLL addListener: ") |
|
|
|
stdout.WriteLine(ret2) |
|
|
|
DllCall("OSC2AHK.dll\addListener", AStr, "/test1", UInt, 0x1001, UInt, oscTypeInt) |
|
|
|
OnMessage(0x1001, "msghandlerInt") |
|
|
|
|
|
|
|
;ret3 := DllCall("OSC2AHK.dll\close") |
|
|
|
;stdout.Write("DLL close: ") |
|
|
|
;stdout.WriteLine(ret3) |
|
|
|
DllCall("OSC2AHK.dll\addListener", AStr, "/test2", UInt, 0x1002, UInt, oscTypeFloat) |
|
|
|
OnMessage(0x1002, "msghandlerFloat") |
|
|
|
|
|
|
|
; ret3 := DllCall("OSC2AHK.dll\open", UInt, hWnd, UInt, 7002) |
|
|
|
; stdout.Write("DLL open: ") |
|
|
|
; stdout.WriteLine(ret3) |
|
|
|
|
|
|
|
DllCall("OSC2AHK.dll\addListener", AStr, "/test2", UInt, 0x1001, UInt, 1) |
|
|
|
DllCall("OSC2AHK.dll\addListener", AStr, "/test3", UInt, 0x1002, UInt, 255) |
|
|
|
OnMessage(0x1002, "msghandlerfloat") |
|
|
|
DllCall("OSC2AHK.dll\removeListener", AStr, "/test2") |
|
|
|
; retOnMsg := OnMessage(0x1001, "msghandler") |
|
|
|
; stdout.Write("DLL addListener: ") |
|
|
|
; stdout.WriteLine(ret2) |
|
|
|
DllCall("OSC2AHK.dll\addListener", AStr, "/test3", UInt, 0x1003, UInt, oscTypeInt+oscTypeFloat) |
|
|
|
OnMessage(0x1003, "msghandlerTest3") |
|
|
|
|
|
|
|
stdout.Close() |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
msghandler(wParam, lParam, msg, hwnd) { |
|
|
|
msghandlerTest3(wParam, lParam, msg, hwnd) { |
|
|
|
stdout := FileOpen("tmp.log", "a") |
|
|
|
stdout.Write("Received MSG: ") |
|
|
|
stdout.Write("Got /test3 with ") |
|
|
|
if (wParam = oscTypeInt) |
|
|
|
{ |
|
|
|
stdout.Write("Int") |
|
|
|
stdout.Write(" ") |
|
|
|
stdout.WriteLine(lParam) |
|
|
|
} |
|
|
|
if (wParam = oscTypeFloat) |
|
|
|
{ |
|
|
|
stdout.Write("Float") |
|
|
|
stdout.Write(" ") |
|
|
|
; Retrieve float from the lParam |
|
|
|
VarSetCapacity(buf, 8, 0) |
|
|
|
NumPut(lParam, buf) |
|
|
|
theFloat := NumGet(buf, "Float") |
|
|
|
stdout.WriteLine(theFloat) |
|
|
|
} |
|
|
|
stdout.Close() |
|
|
|
} |
|
|
|
|
|
|
|
msghandlerInt(wParam, lParam, msg, hwnd) { |
|
|
|
; Check if we actually got a Integer |
|
|
|
if (wParam != 2) |
|
|
|
return |
|
|
|
|
|
|
|
; Log to the logfile |
|
|
|
stdout := FileOpen("tmp.log", "a") |
|
|
|
stdout.Write("Got Int: ") |
|
|
|
stdout.Write(msg) |
|
|
|
stdout.write(" ") |
|
|
|
stdout.Write(wParam) |
|
|
|
stdout.write(" ") |
|
|
|
stdout.Write(" ") |
|
|
|
stdout.WriteLine(lParam) |
|
|
|
stdout.Close() |
|
|
|
} |
|
|
|
|
|
|
|
msghandlerfloat(wParam, lParam, msg, hwnd) { |
|
|
|
msghandlerFloat(wParam, lParam, msg, hwnd) { |
|
|
|
; Check if we actually got a float |
|
|
|
if (wParam != 4) |
|
|
|
return |
|
|
|
|
|
|
|
; Retrieve float from the lParam |
|
|
|
VarSetCapacity(buf, 8, 0) |
|
|
|
NumPut(lParam, buf) |
|
|
|
theFloat := NumGet(buf, "Float") |
|
|
|
|
|
|
|
; Log to the logfile |
|
|
|
stdout := FileOpen("tmp.log", "a") |
|
|
|
thefloat := NumGet(lParam, 0, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 1, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 2, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 3, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 4, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 5, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 6, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 7, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
thefloat := NumGet(lParam, 8, "Float") |
|
|
|
stdout.WriteLine(thefloat) |
|
|
|
stdout.Write("Got Float: ") |
|
|
|
stdout.Write(msg) |
|
|
|
stdout.Write(" ") |
|
|
|
stdout.WriteLine(theFloat) |
|
|
|
stdout.Close() |
|
|
|
} |
|
|
|
|
|
|
|
exithandler() { |
|
|
@ -89,7 +96,7 @@ exithandler() { |
|
|
|
} |
|
|
|
|
|
|
|
do_exit: |
|
|
|
ExitApp |
|
|
|
return ; unnecessary redundancy? |
|
|
|
ExitApp |
|
|
|
return |
|
|
|
|
|
|
|
Esc::GoSub, do_exit |