DetCurrMousePointer



' Found on the net somewhere ....

'

Function GetMouseHandle() As Long
Dim y As Long
Dim tid As Long
Dim hwnd As Long

hwnd = GetForegroundWindow()
tid = GetWindowThreadProcessId(hwnd, y)
If tid = 0 Then
GetMouseHandle = 0
Exit Function
End If
If tid <> GetCurrentThreadId() Then
y = AttachThreadInput(GetCurrentThreadId(), tid, True)
hwnd = GetCursor()
y = AttachThreadInput(GetCurrentThreadId(), tid, False)
End If
GetMouseHandle = hwnd
End Function

(detcurrmousepointer.html)- by Paolo Puglisi - Modifica del 25/3/2019