鼠标的位置已经得到(300,300),但是我不想通过SetCursorPos(x,y)移动鼠标,再用mouse_event来点击这种效果,因为这样会影响鼠标的动作, 我想通过SendMessage点击它,如何实现?
因为要点击的是网页,所以也不方便用下面的方便来实现
pk = FindWindow(vbNullString, ts)    
pp = FindWindowEx(pk, ByVal 0&, "Button", an)
SendMessage pp, BM_CLICK, 0, 0
请问有什么好的办法么?

解决方案 »

  1.   

    call IHTMLElement::click, or gett the IHTMLDocument2::onClick event handler and invoke it
    see also
    http://msdn.microsoft.com/workshop/browser/mshtml/tutorials/sink.asp
      

  2.   

    //我不想通过SetCursorPos(x,y)移动鼠标,再用mouse_event来点击这种效果,因为这样会影响鼠标的动作仔细看看mouse_event函数,其中有这么一段:
    dx,dy在没有使用MOUSEEVENTF_ABSOLUTE标志时是相对于鼠标当前位置的坐标,如果设置为使用绝对坐标,则dx,dy是相对于屏幕的坐标。 因此可以不用SetCursorPos函数,也就不会影响鼠标动作了。