示例#1
0
 protected void ReleaseCOM()
 {
     try
     {
         if (_explorer != null)
         {
             _explorer.Release();
         }
     }
     catch (COMException exception)
     {
         _tracer.TraceException(exception);
     }
 }
示例#2
0
        static public bool StartAndInitializeOutlook(  )
        {
            if (OutlookSession.IsOutlookRun)
            {
                return(true);
            }

            _com_OutlookExporer explorer = null;

            try
            {
                OutlookGUIInit.StartOutlook(ProcessWindowStyle.Minimized);
                IntPtr mainWnd = OutlookGUIInit.PrepareMainWndReady(2000);
                if ((int)mainWnd == 0)
                {
                    return(false);
                }
                ActivateGUI(mainWnd);
                return(IsOutlookExplorerReady(2000) != null);
            }
            catch (COMException exception)
            {
                Tracer._TraceException(exception);
                return(false);
            }
            finally
            {
                if (explorer != null)
                {
                    try
                    {
                        explorer.Release();
                    }
                    catch (COMException exception)
                    {
                        Tracer._TraceException(exception);
                    }
                }
            }
        }