function MouseExists: Boolean;begin Result := GetSystemMetrics(SM_MOUSEPRESENT) <> 0;end;procedure TForm1.Button1Click(Sender: TObject);begin if MouseExists then ShowMessage('Mouse present.');end;