Detect a mouse in the system

Posted in Manipulators

Use GetSystemMetrics function with SM_MOUSEPRESENT parameter.

procedure TForm1.Button1Click(Sender: TObject);
begin
  if GetSystemMetrics(SM_MOUSEPRESENT)<>0 then
    Label1.Caption:='You have a mouse'
  else
    Label1.Caption:='You have not a mouse';
end;