vb Postmessage后台模拟点击句柄控件指定坐标位置
Private Sub Command1_Click()
Picture1.Cls
ClickHwndByXy Picture1.Hwnd, 20, 20
End Sub
Private Sub Form_Load()
'窗体上添加一个按钮控件和图片框控件就可以了
Picture1.DrawWidth = 25
Picture1.ForeColor = vbRed
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.PSet (X, Y)
If Button = 1 Then
MsgBox "坐标被点击:" & X & "--" & Y & ",像素:" & X / Screen.TwipsPerPixelX & "," & Y / Screen.TwipsPerPixelY
End If
End Sub