Board index » delphi » Outllook addin and exception from COM server

Outllook addin and exception from COM server

Hi,
    with the help of Dmitry Streblechenko,  Paul Qualls and other gurus in
this news group I was able to have a Outlook Addin working, thanks!

   Now here comes another problem, if the Add in activates a object from a
out proc COM server(.exe) and the server raise an exception, Outlook will
just close with an error log, I can capture the error with following:

try
    srv := GetActiveOleObject("abc.def");
except
    showmessage('error');
end;

but the compiler will raise an error if I do following:
    try
        ...
    except E: Exception do
        ShowMessage(E.message);
    end;

What is really the correct way to capture exceptions from COM server in an
Outlook Add in?

Thanks.

Frank

 

Re:Outllook addin and exception from COM server


do you get the same error if you call CreateOleObject()??

pq

Quote
"Frank Wang" <w...@cebu.weblinq.com> wrote in message

news:3cda7579_1@dnews...
Quote
> Hi,
>     with the help of Dmitry Streblechenko,  Paul Qualls and other gurus in
> this news group I was able to have a Outlook Addin working, thanks!

Re:Outllook addin and exception from COM server


Hi,

    Actually I forced the error to happen just to check how Addin handles
error.
The problem I like to handle is like this:
    1. The out-proc server runs first, create a object and register it with
ROT
    2. The server has its own menu that can display a modal form.
    3. The Add in can call the mentod to display modal form, this works as
long as the form was not shown using #2
    4. The Add in call the server to display modal form and the form was
already pop up using #2, there is an error that will cause Outlook to crash.
that's the error I tried to handle, and can't find a solution.

regards,

Frank

Quote
"Paul Qualls" <p...@paulqualls.com> wrote in message

news:3cdab023_1@dnews...
Quote
> do you get the same error if you call CreateOleObject()??

> pq
> "Frank Wang" <w...@cebu.weblinq.com> wrote in message
> news:3cda7579_1@dnews...
> > Hi,
> >     with the help of Dmitry Streblechenko,  Paul Qualls and other gurus
in
> > this news group I was able to have a Outlook Addin working, thanks!

Re:Outllook addin and exception from COM server


You should never ever raise errors across COM calls, especially out-of-proc.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

Quote
"Frank Wang" <w...@cebu.weblinq.com> wrote in message news:3cdb1750_1@dnews...
> Hi,

>     Actually I forced the error to happen just to check how Addin handles
> error.
> The problem I like to handle is like this:
>     1. The out-proc server runs first, create a object and register it with
> ROT
>     2. The server has its own menu that can display a modal form.
>     3. The Add in can call the mentod to display modal form, this works as
> long as the form was not shown using #2
>     4. The Add in call the server to display modal form and the form was
> already pop up using #2, there is an error that will cause Outlook to crash.
> that's the error I tried to handle, and can't find a solution.

> regards,

> Frank

> "Paul Qualls" <p...@paulqualls.com> wrote in message
> news:3cdab023_1@dnews...
> > do you get the same error if you call CreateOleObject()??

> > pq
> > "Frank Wang" <w...@cebu.weblinq.com> wrote in message
> > news:3cda7579_1@dnews...
> > > Hi,
> > >     with the help of Dmitry Streblechenko,  Paul Qualls and other gurus
> in
> > > this news group I was able to have a Outlook Addin working, thanks!

Other Threads