I\'m calling Windows APIs from C++ code and I have a helper method to do the FormatMessage
stuff and throw an exception for error handling. The signature of the
This is normal - the "last error" can be set indirectly through any function call.
Some functions set it to "no error" on success, so if you want to use it reliably you need to store it immediately before you do anything else.
If you've ever encountered an "A serious error occurred: The operation completed successfully" dialogue, this is probably the reason.