Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As INPUT_TYPE, ByVal cbSize As Long) As Long
Private Const MOUSEEVENTF_MOVE = &H1
Private Const INPUT_MOUSE = 0
Private Type MOUSEINPUT
dx As Long
dy As Long
mouseData As Long
dwFlags As Long
dwtime As Long
dwExtraInfo As Long
End Type
Private Type INPUT_TYPE
dwType As Long
xi(0 To 23) As Byte
End Type
Private inputEvent(0) As INPUT_TYPE
Function MouseMove0()
Dim mouseEvent As MOUSEINPUT 'https://www.tek-tips.com/viewthread.cfm?qid=1458304
Static initilized As Boolean
If Not initilized Then
mouseEvent.dx = 0 ' Load up the event record
mouseEvent.dy = 0
mouseEvent.mouseData = 0
mouseEvent.dwFlags = MOUSEEVENTF_MOVE
mouseEvent.dwtime = 0
mouseEvent.dwExtraInfo = 0
inputEvent(0).dwType = INPUT_MOUSE ' Copy the record into the input array
CopyMemory inputEvent(0).xi(0), mouseEvent, Len(mouseEvent)
initilized = True
End If
SendInput 1, inputEvent(0), Len(inputEvent(0))
End Function