This sample is located in \Samples\JDirect\Lasterr.
Description
Using the Sample
Key Project Files
Technologies Demonstrated
This sample shows how to capture the SetLastError error code from a Microsoft® Win32® API.
To run the sample
Run Go.bat in the \Samples\JDirect\Lasterr directory.
This file contains a do-while loop in a try block in its main method that uses the SetLastError keyword.
It is not safe to call GetLastError yourself because the Microsoft virtual machine (Microsoft VM) can make API calls itself that overwrite the error value. Instead, you must use the SetLastError keyword to force the Microsoft VM to capture the error code and save it in a per-thread data block. This error code can then be retrieved using the getLastWin32Error method.
This sample shows how to use the following: