title: How should I use FormatMessage() properly in C++?
body: <p><strong>Without</strong>:</p>
  
  <ul>
  <li>MFC</li>
  <li>ATL</li>
  </ul>
  
  <p>How can I use <a href="http://msdn.microsoft.com/en-us/library/ms679351.aspx" rel="noreferrer"><code>FormatMessage()</code></a> to get the error text for a <code>HRESULT</code>?</p>
  
  <pre><code> HRESULT hresult = application.CreateInstance("Excel.Application");
  
   if (FAILED(hresult))
   {
       // what should i put here to obtain a human-readable
       // description of the error?
       exit (hresult);
   }
  </code></pre>