procedure TForm1.Button1Click(Sender: TObject);
var
x: integer;
sl: TStringlist;
s: string;
begin
screen.cursor := crhourglass;
sl := TStringlist.create;
for x := 0 to 20000 do begin
s := SysErrorMessage(x);
if s <> '' then
sl.add(Format('%:5d', [x]) + ' ' + inttohex(x, 4) +
' ' + stringreplace(s, #13#10, #32, [rfreplaceall]));
end;
sl.savetofile('c:\ErrorCode.txt');
screen.cursor := crdefault;
end;