CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    445

    HRESULT to string ??

    Hi ,

    Ia there a function who converts HRESULT value to a string so instread of getting the following output:

    I have:
    Code:
    HRESULT hr;
    hr = MyFunc();
    
    if ( FAILED(hr) )
    {
        Log << "HRESULT=" << hr;
    }
    Output:
    HRESULT =-2147418113

    I'll get:

    Desired output:
    HRESULT=E_UNEXPECTED (2147418113 )


    Many thanks!

  2. #2
    Join Date
    Nov 2008
    Posts
    13

    Re: HRESULT to string ??

    Tried FormatMessage()?
    Last edited by unnamed; December 15th, 2008 at 05:45 AM.

  3. #3
    Join Date
    Dec 2005
    Posts
    445

    Re: HRESULT to string ??

    Quote Originally Posted by unnamed View Post
    Tried FormatMessage()?
    Thanks man it's working !!

    I didn't know that win32 and hresult error code definitions are both defined under the same file.

    Do you know if there are another mesasages FormatMessage() can format except of win32 & hresult ?

    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured