Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

Firing ActiveX control Error event in ATL

    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
mythos128
Asked:
mythos128
1 Solution
 
migelCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now