Sub Process_Globals
Dim x As Double =0
Dim y As Double = 500
Dim NH As NativeHook
Dim t As Timer
Dim tmove As Timer
End sub
Sub AppStart
NH.Initialize("NH", Me) 'Initializes and registers the NativeHook
NH.startNativeKeyListener 'starts a NativeKeyListener
NH.startNativeMouseMotionListener 'startNativeKeyListener 'starts a NativeKeyListener
NH.startNativeMouseInputListener
NH.enableKillCode 'Allows you to manually unregister by pressing Windows_Escape
NH.EnableEventConsumption 'Allows you to consume input events
t.Initialize("t", 60*1000)
t.Enabled = True 'Timer will unregister the NativeHook in 1 minute
tmove.Initialize("tmove", 100)
tmove.Enabled = True 'Timer will unregister the NativeHook in 1 minute
' StartMessageLoop
End Sub
Sub NH_Unregistered
Log("NativeHook unregistered")
' StopMessageLoop 'No more event loops means this program ends here
End Sub
Sub t_Tick
t.Enabled = False
NH.unregisterNativeHook
End Sub
Sub NH_NativeKeyPressed(nke As NativeKeyEvent) As Boolean
If NH.isCharacter(nke.keyCode) Then
Log(nke.keyText & " Pressed")
If nke.keyText=="F" Then Return True 'Consumes the event if the user pressed the "F" key
End If
Return False
End Sub
Sub nh_NativeMouseWheelMoved(nmwe As NativeMouseWheelEvent) As Boolean
Log("Scroll Type: " & nmwe.ScrollType)
Log("Scroll Amount: " & nmwe.ScrollAmount)
Log("Wheel Rotation: " & nmwe.WheelRotation)
Return False
End Sub
Sub nh_NativeMouseMoved(mousemove As NativeMouseEvent) As Boolean
Log("X: " & mousemove.X)
Log("y: " & mousemove.Y)
Log("BTN: " & mousemove.MouseButton)
Return False
End Sub
Sub MainForm_Closed
NH.endNativeKeyListener 'starts a NativeKeyListener
NH.endNativeMouseMotionListener 'startNativeKeyListener 'starts a NativeKeyListener
NH.endNativeMouseInputListener
End Sub
Sub tmove_Tick
move
End Sub
Sub move
x=x+1
y=500
Dim robot As JavaObject
robot.InitializeNewInstance("javafx.scene.robot.Robot", Null)
robot.RunMethod("mouseMove", Array As Object(x, y))
End sub