Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Firing ActiveX control Error event in ATL

Posted on 2002-06-12
4
Medium Priority
?
312 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 400 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

688 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