由谁用过函数MOUSE_event ,在delphi中写一个例子吧,实现在某一个点a:Tpoint处鼠标点击一下,谢谢了!

解决方案 »

  1.   

    MOUSE_event(MOUSEEVENTF_LEFTDOWN,Point1.X,Point1.Y,0,nil)
      

  2.   

    看看msdn帮助吧
    The mouse_event function synthesizes mouse motion and button clicks. Windows NT/2000/XP: This function has been superseded. Use SendInput instead.VOID mouse_event(
      DWORD dwFlags,         // motion and click options
      DWORD dx,              // horizontal position or change
      DWORD dy,              // vertical position or change
      DWORD dwData,          // wheel movement
      ULONG_PTR dwExtraInfo  // application-defined information
    );
      

  3.   

    看看msdn帮助吧
    The mouse_event function synthesizes mouse motion and button clicks. Windows NT/2000/XP: This function has been superseded. Use SendInput instead.VOID mouse_event(
      DWORD dwFlags,         // motion and click options
      DWORD dx,              // horizontal position or change
      DWORD dy,              // vertical position or change
      DWORD dwData,          // wheel movement
      ULONG_PTR dwExtraInfo  // application-defined information
    );
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
       a:tpoint;
    begin
    a.X:=self.Left+button2.Left+10;
    a.Y:=self.Top+ button2.Top+35;
    setcursorpos(a.x,a.y);
    mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
    mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
    //mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);
    //mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
    showmessage('click');
    end;