比如,下图假设是一个窗口的形状,0是窗口的左下角,现在要在Z处(就是"右边3CM,往上2CM处"),模拟鼠标点击一下,如何实现???
  ---- Y11111Z
  2cm  Y111111
  ---- 0XXXXXX
       | 3cm |
谢谢先!!!!

解决方案 »

  1.   

    sendmessage  或者 mouse_event2cm 3cm需要换算为象素单位
      

  2.   

    Private Sub Command1_Click()
        Form_MouseDown 1, 0, 100, 200
    End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        MsgBox CStr(X) + "," + CStr(Y)
    End Sub
      

  3.   

    用API函数应该可以实现。
      

  4.   


    '【参数表】  x,y ------------  鼠标指针在屏幕像素坐标系统中的X,Y位置
    Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Dim x As Long
     Dim y As Long
     x = Screen.Width \ Screen.TwipsPerPixelX
     y = Screen.Height \ Screen.TwipsPerPixelYSetCursorPos x \ 2, y \ 2 '鼠标停靠屏幕中央发送鼠标down & up 信息参考:
    http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=18140