COM互操作& Outlook - 使Outlook可见? [英] COM Interop & Outlook - Make Outlook Visible?

查看:208
本文介绍了COM互操作& Outlook - 使Outlook可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从VB.NET程序自动化Outlook,根据用户的请求将项目传输到日历和联系人。这一切都在工作,这不是问题;问题是自动化像这样,当它还没有打开时创建一个隐藏的实例。我也许可以理解这是如何有用的,停止用户关闭它,而你仍然在使用它,但因为Outlook似乎只强制一个实例,如果用户试图检查我的程序仍然保持挂接到Outlook,没有任何反应 - 一个实例是隐藏的实例,用户看不到任何东西。

I'm automating Outlook from a VB.NET program, transferring items into the calendar and contacts at the user's request. It's all working, that isn't the problem; the problem is that automating Outlook like this when it wasn't already open creates a hidden instance. I can perhaps understand how this could be useful, to stop the user closing it down while you're still working on it, but since Outlook appears to force one instance only, if the user tries to inspect the changes made while my program is still hooked into Outlook, nothing happens - the one instance is that hidden instance and the user can't see anything.

在以前的COM自动化我曾经能够使Word或Excel可见,但我似乎无法做到这一点与Outlook。我尝试过:

In the old days of COM automation I used to be able to make Word or Excel visible, but I seem unable to do that with Outlook. I've tried:

OutlookApp.Visible = True

OutlookApp.Visible = True

OutlookApp.Application.Visible = True

OutlookApp.Application.Visible = True

OutlookApp.ActiveWindow.Visible = True

OutlookApp.ActiveWindow.Visible = True

OutlookApp.ActiveExplorer.Display()

OutlookApp.ActiveExplorer.Display()

但它们都不工作。

这并不重要,但是有谁知道我是否可以让Outlook显示其主窗口?如果我可以让它禁止用户关闭实例,但我会安装显示窗口:)

It's not critical, but does anyone know if I can get Outlook to show its main window? Bonus points if I can get it to disallow the user to close down the instance, but I'll settle for just showing the window :)

推荐答案

我正常测试看看Outlook进程是否首先运行,如果不是,然后shell uplook.exe然后附加。这种方式你永远不应该得到一个隐藏的过程。

I normaly test to see if the "Outlook" process is running first, if not then shell up Outlook.exe then attach. This way you should never get a hidden process.

真的没有办法取消关闭外观,你可以挂断应用程序退出事件断开和处置在你的应用程序。

There really is no way to cancel the shut down outlook, you can hook the application quit event to disconnect and dispose in your app though.

这篇关于COM互操作& Outlook - 使Outlook可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆