Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Detect outlook is running (and not shutting down) (http://www.outlookbanter.com/add-ins-outlook/73285-detect-outlook-running-not-shutting.html)

Federico Delgado June 9th 08 07:59 PM

Detect outlook is running (and not shutting down)
 
Hi,

I am developing some code for outlook right now and the way I am detecting
the application running is by doing:

Marshal.GetActiveObject("Outlook.Application");

If I get a comexception then outlook is not running. The problem is that
sometimes this catches a dying outlook instance and the rest of my code tries
to execute against this non existent instance with all kind of errors.

Is there any way to get the current instance and ensure that it was not in
the middle of a closing process?

Thanks,

Federico

Ken Slovak - [MVP - Outlook] June 9th 08 08:18 PM

Detect outlook is running (and not shutting down)
 
I don't know of any way to do that. You probably will need to use exception
handling for that, possibly with periodic checks to see if the Outlook
window is still there.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Federico Delgado" wrote in
message ...
Hi,

I am developing some code for outlook right now and the way I am detecting
the application running is by doing:

Marshal.GetActiveObject("Outlook.Application");

If I get a comexception then outlook is not running. The problem is that
sometimes this catches a dying outlook instance and the rest of my code
tries
to execute against this non existent instance with all kind of errors.

Is there any way to get the current instance and ensure that it was not in
the middle of a closing process?

Thanks,

Federico




All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com