Solved

COM & Errors

Posted on 1998-07-21
2
208 Views
Last Modified: 2013-11-25
I've got a COM server written in VC++ 5.0 with ATL whose target client is applications written in VB.  What I would love to do is throw an exception from the COM component and have standard error handling in VB be able to trap it.  This approach isn't working.  I'm having a hard time finding any documentation on this issue.  Please help.
0
Comment
Question by:rayb
2 Comments
 
LVL 1

Accepted Solution

by:
eburley earned 50 total points
ID: 1168208
support the ISupportErrorInfo interface, implementing InterfaceSupportsErrorInfo(riid) (ATL has an ISupportErrorInfoImpl which does this for you)

when an error happens:
Call CreateErrorInfo, passing the address of an
 ICreateErrorInfo * as the argument.

you can then use the functions in the ICreateErrorInfo object (SetDescription, SetGUID, SetHelpContext, SetHelpFile, SetSource) to populate the error.

when vb sees the error in IDispatch, it will call GetErrorInfo, then call InterfaceSupportsErrorInfo.  if your interface returns S_OK from this, vb will assume the error is legit, and use the information in the error object to inform the user.
0
 
LVL 2

Author Comment

by:rayb
ID: 1168209
Thanks

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question