在Outlook中添加自己的菜单

来源:互联网 发布:ubuntu插上移动硬盘 编辑:程序博客网 时间:2024/04/29 06:19
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>


Outlook中添加自己菜单    在Microsoft Office 2000中有一个新的功能:COM加载项(COM Add-In)。利用COM加载项,我们可以通过编写COM组件实现将自己的软件集成在Office系列产品中。例如金山词霸.Net就是利用COM加载项实现添加按钮到Word中。    下面的文章将通过如何通过VB编程实现添加按钮到Outlook象大家介绍如何实现COM加载项。要在VB中建立COM加载项,首先需要建立一个ActiveX DLL工程,然后在工程中建立一个类(Class),在类代码中实现Office规定的IDTExtensibility2接口。如果有读者做过或者接触过Shell扩展编程(Shell Extension)和接口(Interface)的话,这些可能都很好理解。如果没有接触过。可以将我们的COM加载项看成服务器,Outlook作为客户,客户如何调用服务器的功能呢?这就需要有一个规范,或者称为协议。服务器只要实现了协议规定的代码,客户就可以直接通过协议来调用服务器程序了,而不用管服务器是如何实现协议的,而Windows编程中接口就是这样的协议。    下面来介绍如何实现COM加载项。首先建立一个新的 ActiveX DLL工程,VB会自动添加一个Class Module:Class1,将Class1的Name属性改为clsOutlook,将工程的Name属性改为MyOutlook,然后保存工程。    要实现IDTExtensibility2接口,必须引入对IDTExtensibility2接口的定义。另外我们还需要引入Office以及Outlook库,点击菜单 Project | References 项,在引用列表中选中如下的三项:<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>