| Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
|
When is a EWin32Error exception raised?
Question: What is the EWin32Error exception good for?Answer: As of release 3, Delphi has a SysUtils routine called Win32Check() which you can pass an API result to. If it is False, it will raise an EWin32Error exception which is given the descriptive message. If you don't like to raise an exception, you can use GetLastError() and pass the error code to SysErrorMessage() to get a descriptive string (it's actually the same string that the exception will have as a message). Below is an example written in Delphi 7.
Comments:
|