Solved

Firing ActiveX control Error event in ATL

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to monitor remote shell execution on linux 9 93
sameEnds challenge 3 107
Slow process to read Excel 15 104
Thin secure Windows 10 5 49
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…

744 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

11 Experts available now in Live!

Get 1:1 Help Now