Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Jan : How to acquire exception message from behind the COM "border"?

www.cryer.info
Managed Newsgroup Archive

How to acquire exception message from behind the COM "border"?

Subject:How to acquire exception message from behind the COM "border"?
Posted by:"mikk" (mikk@nospamplease.go2.pl)
Date:Tue, 10 Jan 2006 13:12:51 +0100

Hi,

Let's assume I have some COM server written in Delphi. The methods of
this COM server have to be implemented as *safecall* - to return HRESULT
code and trapping all unhandled exceptions and return E_FAIL when an
exception occurs.

The COM client written in C++ creates COM server using
CoCreateInstance() and gets the COM interface variable. Then he calls a
method of the server through the COM interface. An exception occurs
during the COM server method execution. It is implemented as *safecall*,
so all unhandled exceptions are trapped and only the HRESULT value is
returned indicating an error.

HRESULT hr = m_pMyComSrv->MyComMethod();
if FAILED(hr)
{
    // I'd like to know what exactly did happened
    return false;
}

But I want to get more information on exception inside the COM server.
The problem is that the COM client code is written in C++. I don't think
I'm able to do it in ATL. How to acquire the exception message using
Windows API? I think it is possible, because the EOleException which is
raised on this situation in Delphi clients does the job. I was trying to
dive into the low level Delphi RTL code to find out, but without success.


Thanks in advance,
mikk

Info

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive