2009. szeptember 9., szerda
How to change the mouse speed
Problem/Question/Abstract:
How to change the mouse speed
Answer:
Solve 1:
The mouse speed is changed in seven steps. Adjust the values in mspeed, if you like.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
var
check: array[0..2] of Integer;
const
mspeed: array[0..6, 0..2] of Integer = ((0, 0, 0), (10, 0, 1), (7, 0, 1), (4, 0, 1), (4, 10, 2), (4, 7, 2), (4, 4, 2));
tempo: Integer = -1;
procedure step;
begin
inc(tempo);
if tempo > 6 then
tempo := 0;
systemparametersinfo(SPI_SETMOUSE, 1, @mspeed[tempo], 0);
form1.label1.caption := 'Step: ' + inttostr(tempo + 1);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
systemparametersinfo(SPI_GETMOUSE, 0, @check, 0);
step;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
systemparametersinfo(SPI_SETMOUSE, 1, @check, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
step;
end;
end.
Solve 2:
Use SystemParameters info as shown below.
type
TMouseTresholdSpeed = array[0..2] of Cardinal;
function GetMouseTresholdSpeed: TMouseTresholdSpeed;
{ Retrieves the two mouse threshold values and the mouse speed }
begin
SystemParametersInfo(SPI_GETMOUSE, 0, @Result, 0);
end;
procedure SetMouseTresholdSpeed(Value: TMouseTresholdSpeed);
{ Sets the two mouse threshold values and the mouse speed }
begin
SystemParametersInfo(SPI_SETMOUSE, 0, @Value, 0);
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése