custom HRESULT in MSSOAP toolkit revisited. 
Author Message
 custom HRESULT in MSSOAP toolkit revisited.

I have to mention that the object does not have IErrorInfo support, and is
not written by me, so I cannot add it myself (replies for the previuos post
suggested that). Here is the original message. Thank you for your time!

Hi list!

I use a COM object (from the SOAP SDK 3.0) which returns custom HRESULTs
when errors occur. How can I decode these HRESULTs to their string
equivalent (textual description)? I use Visual C++ 6.0 and #import to
generate smart pointers/wrappers for the COM interfaces. So the methods
throw com_error exceptions when something goes wrong, but the ErrorMessage()
method returns the generic "Unknown error" message.

I read through documentation that com_error implementation uses
FormatMessage to find that string. I noticed it takes a HMODULE handle to
know where to look for the message table, but the com_error implementation
doesn't use it. I believe that I have to manually load the library to obtain
the HMODULE and call FormatMessage myself? This is not a nice solution, as I
don't know at run-time what DLL is loaded for MSSOAP, as the COM subsystem
does that, through the registry (of course I can find out its name, but
still, it's not a nice way to deal with this..)

How could I do find that textual error description?

Thanks in advance,
iuli



Sun, 29 May 2005 21:27:48 GMT  
 custom HRESULT in MSSOAP toolkit revisited.

FormatMessage works only if you have resource 11,
generated by message compiler. This is the first thing to
check. After that you have to load the dll where this
resource is present or add that resource to your module.
If you do not have the resource 11 and can not find
any .mc (input for message compiler) in your project, you
have to do all the work yourself decoding custom HRESULTS
etc.

AlexO

P.S. Almost forgot, another way of doing it would be to
use standard com facilities. In your component you can use
SetErrorInfo, after the method call com_error should(I am
not sure) check it first.

Quote:
>-----Original Message-----
>I have to mention that the object does not have

IErrorInfo support, and is
Quote:
>not written by me, so I cannot add it myself (replies for
the previuos post
>suggested that). Here is the original message. Thank you
for your time!

>Hi list!

>I use a COM object (from the SOAP SDK 3.0) which returns
custom HRESULTs
>when errors occur. How can I decode these HRESULTs to
their string
>equivalent (textual description)? I use Visual C++ 6.0
and #import to
>generate smart pointers/wrappers for the COM interfaces.
So the methods
>throw com_error exceptions when something goes wrong, but
the ErrorMessage()
>method returns the generic "Unknown error" message.

>I read through documentation that com_error
implementation uses
>FormatMessage to find that string. I noticed it takes a
HMODULE handle to
>know where to look for the message table, but the

com_error implementation
Quote:
>doesn't use it. I believe that I have to manually load

the library to obtain

- Show quoted text -

Quote:
>the HMODULE and call FormatMessage myself? This is not a
nice solution, as I
>don't know at run-time what DLL is loaded for MSSOAP, as
the COM subsystem
>does that, through the registry (of course I can find out
its name, but
>still, it's not a nice way to deal with this..)

>How could I do find that textual error description?

>Thanks in advance,
>iuli

>.



Sun, 29 May 2005 21:47:14 GMT  
 custom HRESULT in MSSOAP toolkit revisited.

Quote:

> >-----Original Message-----
> >I have to mention that the object does not have
> IErrorInfo support, and is
> >not written by me, so I cannot add it myself (replies for
> the previuos post
> >suggested that). Here is the original message. Thank you
> for your time!

> P.S. Almost forgot, another way of doing it would be to
> use standard com facilities. In your component you can use
> SetErrorInfo, after the method call com_error should(I am
> not sure) check it first.

Nope, the OP noted (in the quoted paragraph) that error info is not
supported and cannot be added.

--
Craig Powers
MVP - Visual C++



Sun, 29 May 2005 22:35:29 GMT  
 custom HRESULT in MSSOAP toolkit revisited.
The messages won't come from the SOAP DLL, but from your own
message DLL you build off the source produced by MC.EXE. Again,
see the MC sample.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> I have to mention that the object does not have IErrorInfo support, and is
> not written by me, so I cannot add it myself (replies for the previuos post
> suggested that). Here is the original message. Thank you for your time!

> Hi list!

> I use a COM object (from the SOAP SDK 3.0) which returns custom HRESULTs
> when errors occur. How can I decode these HRESULTs to their string
> equivalent (textual description)? I use Visual C++ 6.0 and #import to
> generate smart pointers/wrappers for the COM interfaces. So the methods
> throw com_error exceptions when something goes wrong, but the ErrorMessage()
> method returns the generic "Unknown error" message.

> I read through documentation that com_error implementation uses
> FormatMessage to find that string. I noticed it takes a HMODULE handle to
> know where to look for the message table, but the com_error implementation
> doesn't use it. I believe that I have to manually load the library to obtain
> the HMODULE and call FormatMessage myself? This is not a nice solution, as I
> don't know at run-time what DLL is loaded for MSSOAP, as the COM subsystem
> does that, through the registry (of course I can find out its name, but
> still, it's not a nice way to deal with this..)

> How could I do find that textual error description?

> Thanks in advance,
> iuli



Mon, 30 May 2005 03:51:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Exceptions and HResults revisited

2. Unable to add custom C# control to a form - Exception from HRESULT: 0x80131019

3. custom HRESULT decoding to error message

4. Custom HRESULTs question.

5. Custom HRESULTs

6. Custom HRESULTS

7. problem with custom HRESULTS

8. HOWTO : Design-time custom collection editing for custom control

9. ATL and custom "static HRESULT WINAPI UpdateRegistry(BOOL bRegister)"

10. Custom build commands for custom file types

11. Problem with custom template files in VC5 custom AppWizards

12. Problem with custom template files in VC5 custom AppWizards

 

 
Powered by phpBB® Forum Software