Avatar of mrwad99
mrwad99Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Get IMAPI2 error string

Ah hello.

I would like to know if there is any method, apart from a huge self-written switch statement, to obtain the descriptive string associated with an IMAPI2 error.  For example

E_IMAPI_RECORDER_MEDIA_NO_MEDIA = "There is no media in the device." (value of 0xC0AA0202)

I thought that

_com_error_(<erroneous HRESULT>).ErrorMessage()

would do the trick, but it always comes back with "Unknown error".

Any ideas?

TIA
Microsoft DevelopmentSystem ProgrammingC++

Avatar of undefined
Last Comment
mrwad99
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Hi mrwad99,

Look into the Microsoft macros that are specifically intended for handling HRESULT values (your hex error code is an HRESULT).

  http://msdn.microsoft.com/en-us/library/ms691242.aspx


Regarding the original question, use the Win32 WPI FormatMessage to get the system error message.


Kent
Avatar of mrwad99
mrwad99
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Kent

Thanks for the response.  Unfortunately that does not work.  I used

HRESULT_CODE(hResult)

to extract the integer error code then passed this along to FormatMessage.  The integer error code is 514, which does not correspond to an error message using the tool ErrLookup.  Sure enough, FormatMessage brings back an empty string.

Any other ideas?
ASKER CERTIFIED SOLUTION
Avatar of mrwad99
mrwad99
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
C++
C++

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

58K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo