VB Code:
Private Sub Form_Load()
' frmClickTo.Show
FormTopMost Me
End Sub
'
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim iX As Integer
Dim iY As Integer
Dim Pos As PointAPI
Dim lHwnd As Long
GetCursorPos Pos
Me.Visible = False
DoEvents
lHwnd = WindowFromPoint(Pos.x, Pos.Y)
SetForegroundWindow lHwnd
SysSetFocus lHwnd
DoEvents
Select Case Button
Case vbLeftButton
' mouse_event MOUSEEVENTF_LEFTDOWN, Pos.X, Pos.Y, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
' mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Case vbRightButton
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
Case vbMiddleButton
mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
End Select
Me.Visible = True
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim Pos As PointAPI
GetCursorPos Pos
Me.Visible = False
DoEvents
lHwnd = WindowFromPoint(Pos.x, Pos.Y)
SetForegroundWindow lHwnd
SysSetFocus lHwnd
DoEvents
'Debug.Print x
'Debug.Print Pos.x
'Debug.Print
'Debug.Print Y
'Debug.Print Pos.Y
Me.Visible = False
DoEvents
Select Case Button
Case vbLeftButton
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Case vbRightButton
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
Case vbMiddleButton
mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
End Select
Me.Visible = True
End Sub