BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regarding creating a custom EOleException

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Philip
Guest





PostPosted: Mon Apr 25, 2005 3:32 pm    Post subject: Regarding creating a custom EOleException Reply with 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
Dmitry Streblechenko
Guest





PostPosted: Mon Apr 25, 2005 6:11 pm    Post subject: Re: Regarding creating a custom EOleException Reply with quote



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





PostPosted: Tue Apr 26, 2005 10:30 am    Post subject: Re: Regarding creating a custom EOleException Reply with quote



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





PostPosted: Wed Apr 27, 2005 8:44 pm    Post subject: Re: Regarding creating a custom EOleException Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.