Convert HRESULT hex error code to string

  • Thread starter Thread starter WATER004
  • Start date Start date
W

WATER004

Guest
Hi all,



Is there a way to convert an HRESULT hex error code to a string? To better illustrate this, here is a sample code:




HRESULT hr = CoInitialize(NULL);

if(FAILED(hr))
{
//This is what I want to store into a string.
//"Failed to Initialize COM. Error code = 0x" << hex << hr << endl;

string hexerrorcode = ?;

CoUninitialize();
return 0;
}


I am not sure how to put it into string.



Can anyone help me with this?



Thank you!

Continue reading...
 
Back
Top