 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Philip Guest
|
Posted: Mon Apr 25, 2005 3:32 pm Post subject: Regarding creating a custom EOleException |
|
|
Hi All,
I have created a COM business object library in Delphi 7 and created a custom exception deriving from EOleException for this library. Whenever I catch this Exception from other applications, it is coming as EOleException type only. Is there something else I have to do for this?
Thanks in advance
|
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Mon Apr 25, 2005 6:11 pm Post subject: Re: Regarding creating a custom EOleException |
|
|
When an exception is raised inside of a safecall method, Delphi RTL catches
it and converts it to an appropriate HResult return code. Real exceptions
are never ever propagated accross COM calls, especially out-of-proc. Every
IDispatch-friendly COM call must return an HResult (which is just an int)
and Delphi makes sure this happens.Plus you cannot use "is" and "as"
operators accross executable boundaries, either in-proc or out-of-proc, so
you type casting won't work.
Try to use custom error codes instead.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Philip" <philjo (AT) gmail (DOT) com> wrote
| Quote: |
Hi All,
I have created a COM business object library in Delphi 7 and created a
custom exception deriving from EOleException for this library. Whenever I
catch this Exception from other applications, it is coming as
EOleException type only. Is there something else I have to do for this?
Thanks in advance
|
|
|
| Back to top |
|
 |
George Birbilis Guest
|
Posted: Tue Apr 26, 2005 10:30 am Post subject: Re: Regarding creating a custom EOleException |
|
|
| Quote: | Plus you cannot use "is" and "as" operators accross executable boundaries,
either in-proc or out-of-proc, so you type casting won't work.
|
you mean you can't also use QueryInterface?
I always thought "as" was using that, but after some bad experiences with
"as" I tend to think otherwise
--
-----
George Birbilis (birbilis (AT) kagi (DOT) com)
Microsoft Most Valuable Professional
MVP J# for 2004 & 2005
http://www.kagi.com/birbilis
--------------
|
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Wed Apr 27, 2005 8:44 pm Post subject: Re: Regarding creating a custom EOleException |
|
|
No, QueryInterface works just fine. "Is" and "as" under the hood compare the
pointers to the RTTI info tables, which will be different if the same class
is compiled into 2 executables (e.g. exe and dll).
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"George Birbilis" <birbilis (AT) kagi (DOT) com> wrote
| Quote: | Plus you cannot use "is" and "as" operators accross executable
boundaries, either in-proc or out-of-proc, so you type casting won't
work.
you mean you can't also use QueryInterface?
I always thought "as" was using that, but after some bad experiences with
"as" I tend to think otherwise
--
-----
George Birbilis (birbilis (AT) kagi (DOT) com)
Microsoft Most Valuable Professional
MVP J# for 2004 & 2005
http://www.kagi.com/birbilis
--------------
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|