Solved

COM & Errors

Posted on 1998-07-21
2
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

729 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