Problem with multiple Inspectors

V

Voyager

Hi!
I'm developing a Addin in VC++ to add a toolbar (and a button) to the email
Inspector... I Advise a "new inspector" on the NewInspector Event, adding it
the "Activate", "Deactivate" and "Close" event. But the same code crashes
when a 2nd Inspector is created (2 "new mail" windows) ...
Could someone help me?


void __stdcall CAddin::OnInspectors_NewInspector(IDispatch* Ctrl){
....
CComQIPtr<Outlook::_Inspector> spInspector(Ctrl);
// setup InspectorActivateEvent... --------------------
hr = Inspector_ActivateEvent::DispEventAdvise((IDispatch*)spInspector);
if(FAILED(hr))
ATLTRACE("Failed advising to ApplicationEvents");

// setup InspectorDeactivateEvent... -------------------------
hr = Inspector_DeactivateEvent::DispEventAdvise((IDispatch*)spInspector);
if(FAILED(hr))
ATLTRACE("Failed advising to ApplicationEvents");

// setup InspectorCloseEvent... ------------------
hr = Inspector_CloseEvent::DispEventAdvise((IDispatch*)spInspector);
if(FAILED(hr))
ATLTRACE("Failed advising to ApplicationEvents");
....
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top