Kbase 17655: How to Call WIN32 API Function: GetLastError
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  30/04/1999 |
|
How to Call WIN32 API Function: GetLastError
DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes
only. If you have specific questions about which API calls would be
best suited to your design goals, please consult your Microsoft
documentation.
INTRODUCTION:
=============
The following sample code shows how to call the Win32 API function
called GetLastError. This function returns the last error set by
the system in the thread's local storage area. GetLastError() is
thread dependent, which means errors will not be shared among threads
of a process. Please note that due to a bug, this API call will only
work in Progress Versions 9.0B and later. All other versions will
always return a value of 127.
This code has been tested on Windows NT 4.0 Workstation only.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.
PROCEDURE GetLastError EXTERNAL "KERNEL32.DLL":
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.
RUN GetLastError (OUTPUT intResult).
MESSAGE "Last API Error = " intResult VIEW-AS ALERT-BOX.