Viewing the Last Error Code for the Current Thread
You can view the last error code for the current thread (the value returned by a call to GetLastError). The debuggers uses a pseudoregister called ERR for this purpose. You can view the contents of this pseudoregister in the Watch window or Quickwatch dialog using the standard procedures for displaying registers (discussed in Viewing the Value of a Variable or Contents of a Register).
To display the error code in meaningful form, use the hr format specifier with ERR: