http://www.chinaithero.com/一步一步教你怎么做:)

解决方案 »

  1.   

    给你一个:
    下面是一个ontimer事件,可以把鼠标慢慢移动到当前窗口的右上角的“关闭”按钮,然后模拟鼠标单击来关掉窗口,
    procedure TForm1.Timer1Timer(Sender: TObject);
    Var
      h1,h:Hwnd;
      r:Trect;
      j,i:integer;
    begin
      Sleep(500);
      h1:=GetDesktopWindow();
      h:=GetForegroundWindow();
      if h1=h then
          begin
            h:=GetNextWindow(h1,GW_HWNDPREV);
            SetForegroundWindow(h);
            GetWindowRect(h,r);
            setcursorpos(r.Left+20,r.Bottom);
            For i:=r.Bottom downto (r.Top+10) do
                begin
                    setcursorpos(r.Left+20,i);
                    Sleep(6);
                end;
            For j:=(r.Left+20) to (r.Right-13) do
                begin
                    Setcursorpos(j,r.Top+10);
                    Sleep(6);
                end;
                    Sleep(10);
                    Mouse_Event(MOUSEEVENTF_LEFTDOWN,j,i+145,0,0);
                    Mouse_Event(MOUSEEVENTF_LEFTUP,j,j,0,0);
                    Sleep(15);
          end
      else
          begin
            SetForegroundWindow(h);
            GetWindowRect(h,r);
            setcursorpos(r.Left+20,r.Bottom);
            For i:=r.Bottom downto (r.Top+10) do
            begin
                setcursorpos(r.Left+20,i);
                Sleep(6);
            end;
            For j:=(r.Left+20) to (r.Right-13) do
                begin
                    Setcursorpos(j,r.Top+10);
                    Sleep(6);
                end;
                Sleep(10);
                Mouse_Event(MOUSEEVENTF_LEFTDOWN,j,i+145,0,0);//模拟鼠标按下
                Mouse_Event(MOUSEEVENTF_LEFTUP,j,j,0,0);
                Sleep(15);
          end;end; 
      

  2.   

    在http://www.chinaithero.com/ 的什么地方有