Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

about " void _com_issue_error (HRESULT) "

189 views
Skip to first unread message

vlad

unread,
Nov 22, 2000, 3:00:00 AM11/22/00
to
The function is declared in <comdef.h> file. Include this file and the
needed library will be linked automatically.

Vladimir.

"robin" <robi...@21cn.com> wrote in message
news:OIC7pKMVAHA.216@cppssbbsa03...
> In a COM environment program , I need to handle COM exception, use the
> function: void _com_issue_error(HRESULT)
> //...
> HRESULT hr;
> _com_issue_error(hr);
> //...
> VC even display parameter of the function, but i built it, VC prompt
> " _com_issue_error " is undeclare identifier !
> and i can't found the Document about "_com_issue_error" in MSDN, why ?
>
>
>
>
>
>

robin

unread,
Nov 22, 2000, 2:39:25 PM11/22/00
to

Adrian Edmonds

unread,
Nov 23, 2000, 3:00:00 AM11/23/00
to

"robin" <robi...@21cn.com> wrote in message
news:OIC7pKMVAHA.216@cppssbbsa03...
If,as I suspect, you're using this inside a COM method, don't. Just return
E_FAIL or whatever. It is considered rude to throw exceptions from COM
objects (unless it's ATL of course)
Adrian

Paul

unread,
Nov 27, 2000, 3:00:00 AM11/27/00
to
> If,as I suspect, you're using this inside a COM method, don't. Just return
> E_FAIL or whatever. It is considered rude to throw exceptions from COM
> objects (unless it's ATL of course)

What's the reason for the "unless it's ATL" bit? I thought you just plain
shouldn't throw exceptions across a COM interface ?

Paul

Jeff Kohn

unread,
Dec 11, 2000, 2:24:09 PM12/11/00
to

"Adrian Edmonds" <adr...@sentry-com.co.il> wrote in message
news:OxebmEUVAHA.242@cppssbbsa05...

> "robin" <robi...@21cn.com> wrote in message
> news:OIC7pKMVAHA.216@cppssbbsa03...
> If,as I suspect, you're using this inside a COM method, don't. Just return
> E_FAIL or whatever. It is considered rude to throw exceptions from COM
> objects (unless it's ATL of course)
> Adrian

Actually, it's just rude to throw exceptions that you don't plan on
catching. If you want to throw an exception to catch it in another part of
your code, that's perfectly fine, and many people find it prefarable to
bunches of inline error handling after each and every call that returns an
HRESULT.

On the off chance that the original poster was trying to return error
information to a COM client, I would suggest looking into
CComCoClass::Error() function for a relatively easy way to provide rich
error information.

Jeff

0 new messages