Solved

COM & Errors

Posted on 1998-07-21
2
206 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

816 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now