Mega Code Archive

 
Categories / Delphi / Examples
 

Mouse la ilgili ayarlar

-disable mouse procedure TForm1.Button1Click(Sender: TObject); var Freezed:Boolean; R : TRect; Q : TPoint; begin GetCursorPos(Q); if not Freezed then begin R.Left := Q.x; R.Top := Q.y; R.Right := R.Left +1; R.Bottom := R.Top +1; ClipCursor(@R); end else ClipCursor(Nil); Freezed := not Freezed; end; or winexec(Pchar('rundll32 mouse,disable'),sw_Show); -------------------------------------------------------------- -hide mouse trails SystemParametersInfo(SPI_SETMOUSETRAILS,0,nil,SPIF_SENDCHANGE); -------------------------------------------------------------- -show mouse trails SystemParametersInfo(SPI_SETMOUSETRAILS,6,nil,SPIF_SENDCHANGE); ---------------------------------------------------------------- -swap buttons SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 1, nil, 0); ---------------------------------------------------------- -return mouse buttons to normal SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 0, nil, 0); ------------------------------------------------------------ -crazy mouse //interval on time to 10 procedure TForm1.Timer1Timer(Sender: TObject); var NewX,NewY:Integer; Pnt:TPoint; begin NewX:=Random(2); NewY:=Random(2); if NewX = 0 then NewX:=-10 else NewX:=10; if NewY = 0 then NewY:=-10 else NewY:=10; GetCursorPos(Pnt); SetCursorPos(Pnt.x + NewX,Pnt.y + NewY); end; -------------------------------------------------------------- -bungie mouse var Form1: TForm1; ox,oy,vx,vy,ax,ay : real; procedure TForm1.FormCreate(Sender: TObject); begin ox := mouse.CursorPos.X; oy := mouse.CursorPos.y; vx := random(20)-10; vy := random(20)-10; ax := 0; ay := 0.5; end; //timer interval set to "1" procedure TForm1.Timer1Timer(Sender: TObject); begin vx := vx + ax; vy := vy + ay; ox := ox + vx; oy := oy + vy; if (ox < 0) or (ox >= screen.Width) then begin vx := 0-vx*0.8; ox := ox+2*vx; end; if (oy < 0) or (oy >= screen.Height) then begin vy := 0-vy*0.8; oy := oy+2*vy; end; mouse.CursorPos := point(round(ox),round(oy)); end; procedure TForm1.Button1Click(Sender: TObject); begin Timer1.enabled:=true; end; procedure TForm1.Button2Click(Sender: TObject); begin Timer1.enabled:=False; end; -----------------------------------------------------------