Главная страница | назад





Article #17130: Getting a string representation of a Windows error code

 Question and Answer Database

FAQ2130D.txt   Getting a string representation of a Windows error code
Category   :VCL
Platform    :All
Product    :All 32 bit  

Question:
How can I get a string representation of the last Windows error
value returned by the Windows GetLastError?

Answer:
Use the RTL function SysErrorMessage(GetLastError).

Example:

procedure TForm1.Button1Click(Sender: TObject);
begin
 {Cause a Windows system error message to be logged}
  ShowMessage(IntToStr(lStrLen(nil)));
  ShowMessage(SysErrorMessage(GetLastError));
end;


7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99