Exception after the NewInspector event was fired in OL2000

S

Semut

Hello,

I have set up a NewInspector handler in my COM Addin. In Outlook 2003.
The Newinspector is working fine but when I switch back to Outlook 2000, a
funny exception will occur everytime after exit the NewInspector handler
function scope. This will force my debugger to be blocked by the exception
there and can't continue but terminate the debugging process. Why is it so?
Anyone came across this problem before?

thank you.
 
M

Michael Tissington

Which version of the Outlook Object library did you use to build your add-in
?

If you want you code to work with older versions of Outlook, then it is a
good idea to use the object library from the oldest version of Outlook
 
S

Semut

No, I was using the correct object library. It is not because of that.

I have found the problem already. Wow, this is a painful one. I almost
gotten into installing a fresh Outlook in a test PC, luckily one of my
programming discipline books taught me always assume all bugs are own doing,
which keeps me holding on testing it.

It is the COM smart pointer that causes it,

In my codes, usually I will just declare my handler as such, so that I have
no need in worry on releasing it upon exit the function scope.

void __stdcall CAddin::OnNewInspector(_InspectorPtr spInspector)
{

This will work in Outlook 2003 or XP but not in Outlook 2000. This is a bit
odd as I presume declaring as such will invoke the copy constructor and make
a copy of the instance which Outlook passed into the handler, the IDispatch
(in VB context, it is called Object), the original one should be
intacted.But apparently, it is not working as such in Outlook 2000.

and this code will work however.

void __stdcall CAddin::OnNewInspector(IDispatch *Ctrl)
{
CComQIPtr < Outlook::_Inspector> spInsp(Ctrl);


thanks anyway.
 

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