Found this trick in the Jeffrey Richter’s Windows via C/C++ book (in Chapter 1). Visual Studio debugger has a very useful feature – it can monitor the thread’s last error code. You can display this error code together with its text description in the Watch window by typing $err,hr. In case some API call fails, the Watch window will show the error code (the one that would be returned by the GetLastError function). Thanks to the ,hr qualifier, the Watch window shows the error description as well (the string mentioned in the WinError.h header file for the occured error code).