Solved

Firing ActiveX control Error event in ATL

Posted on 2002-06-12
4
309 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…

631 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