Get the last error message Posted in System info Use GetLastError function to get code of the last error and SysErrorMessage function to convert this code to string. procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(SysErrorMessage(GetLastError)); end;