System Delphi

Title: Get the last error message
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;