Throwing an Error from ATL COM controls method 
Author Message
 Throwing an Error from ATL COM controls method

Hi,
Does any one know of how to throw an exception or error from a ATL COM
controls method, when an event of this control occurs..
In detail, assume that an atl com control has a method say Method1()
and an event Event1(). Now Method1() is being invoked by the user, and
the event1() also is triggerred, when event1() is triggered and at that
time if the execution is inside Method1(), how can the method throw
exception when the event is triggered while it is in execution.....

Immediate help is greatly appreciated........
Thanks in Advance.........

Aruna.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 01 Apr 2003 03:00:00 GMT  
 Throwing an Error from ATL COM controls method

I don't really get it. If you want to raise an exception, you have to be
at least executing... At this point you are not executing - the client
does in its event sink.

Anyway, you cannot throw exceptions across COM interface boundaries.
Instead, you return a failure HRESULT from the method. You can also
optionally provide some information about the error by implementing
ISupportErrorInfo, confirming your interface supports rich information
in the implementation of its only method and then setting the error info
via CComCoClass::Error() or AtlReportError() immediately prior to
returning with the failure HRESULT from your method.

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

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

Quote:

> Hi,
> Does any one know of how to throw an exception or error from a ATL COM
> controls method, when an event of this control occurs..
> In detail, assume that an atl com control has a method say Method1()
> and an event Event1(). Now Method1() is being invoked by the user, and
> the event1() also is triggerred, when event1() is triggered and at that
> time if the execution is inside Method1(), how can the method throw
> exception when the event is triggered while it is in execution.....

> Immediate help is greatly appreciated........
> Thanks in Advance.........

> Aruna.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sat, 05 Apr 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ATL COM - Passing ATL COM classes through another ATL COM class in the same app

2. COM/ATL novice:passing object pointers through methods on a COM interface

3. ATL COM DLL :: DllRegisterserver throw exception 0x80029c4a

4. Throw exception from ATL COM for both VB and VC++ client

5. Atl com control permission denied error

6. MFC + ATL: throwing an error back to VB

7. How to invoke methods of contained ActiveX control from ATL Composite Control

8. Cant use VC ATL COM DLL method at VB project

9. Howto Expose a normal C++ class with methods via an Interface Class in ATL COM

10. how to call function in a DLL from ATL COM method

11. Issues with static members/methods in COM/ATL?

12. how to call function in a DLL from ATL COM method

 

 
Powered by phpBB® Forum Software