Solved

Firing ActiveX control Error event in ATL

Posted on 2002-06-12
4
307 Views
Last Modified: 2013-11-25
    ActiveX control can support a standard Error event. I'm writing an ActiveX control using ATL and want to fire this event to the container. In MFC I would use COleControl::FireError(). Is there something similar in ATL? Of course, I can retrieve IDispatch pointer that the container have passed to my control via IConnectionPoint::Advise and then call Invoke on this pointer, but this seems a lot of trouble with setting up parameters.
0
Comment
Question by:mythos128
[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
4 Comments
 
LVL 12

Accepted Solution

by:
migel earned 100 total points
ID: 7074811
Hi!
of course you can rise Error from the ATL code.
1. Your Object must implement ISupportErrorInfo interface (there is checkBox in the wisard).
2. Return error code by ATL method Error()
for example:
return Error(IDS_..., IID_..., MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF,1026));

where IDS_ - id of the resource string that describe your error;
1026 - your error code.
IID_... your interface GUID that method rises error.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

732 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