我想做一个小的程序,运行程序以后,鼠标所在的位置每隔一个时间段(例如:1分钟)就左键自动单击一下。这应该用什么api什么函数实现阿?!还请大哥们帮忙~~~~我的可用分不多了,一共就100多一点,我放血给大家50分!~

解决方案 »

  1.   


      鼠标自动点击的例子,模拟鼠标点击 
    procedure TForm1.Button1Click(Sender: TObject);varx,y:integer;beginx:= form1.Left+button2.Left+25;y:= top+button2.Top+27;SetCursorPos(x,y);Mouse_Event(MOUSEEVENTF_LEFTDOWN,X,Y,0,0);Mouse_Event(MOUSEEVENTF_LEFTUP,X,Y,0,0);end;procedure TForm1.Button2Click(Sender: TObject);beginshowmessage('fksj');end;*************************************// Set the mouse cursor to position x,y:SetCursorPos(x, y);// Simulate the left mouse button downmouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);// Simulate the right mouse button downmouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); 
     
     
      

  2.   

    mrtxc(阿春),哇,你真是好人一个呀,我找了那么多兄弟的文章,他们都说得太复杂且不能编译,你的简洁可编译,爽,谢谢!