[Tip] Debugging: Put a Watch on LastError
Interesting tip from the Sysinternals Newsletter, February 19, 2003. Quoted material:
*VISUAL STUDIO: PUT A WATCH ON LASTERROR If you develop applications that rely on the Win32 API then you've almost certainly have written code that executes a Win32 function, but for whatever reason doesn't report specific errors. If so, you'll find this tip useful. By adding the expression "@ERR,hr" to the watch window you'll see the numeric and textual representation of the value stored as the current thread's LastError variable, which is the value returned by the GetLastError() Win32 function.