Outlook Add-in(COM加载项)技术指南(一)

<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>

COM" target=_blank>in: 0cm 0cm 0pt; WORD-BREAK: break-all; TEXT-COM" target=_blank>inDENT: 42.15pt; TEXT-ALIGN: right; mso-char-COM" target=_blank>indent-count: 1.0" align=right>COM" target=_blank>Outlook COM" target=_blank>Add-COM" target=_blank>in(COM加载项)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-COM:office:office" />

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 42.15pt; TEXT-ALIGN: right; mso-char-COM" target=_blank>indent-count: 1.0" align=right>技术指南

COM" target=_blank>in: 13pt 0cm">Revision History:

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center>Version

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center>Date

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center>Creator

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center>Description

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-COM:office:smarttags" />1.0.0.1

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center>2004-3-9

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center>郑昀

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center>草稿

COM" target=_blank>in: 13pt 0cm">COM" target=_blank>inE-HEIGHT: 173%; FONT-FAMILY: 黑体; mso-bidi-font-size: 16.0pt; mso-ascii-font-family: Arial">摘要COM" target=_blank>inE-HEIGHT: 173%; FONT-FAMILY: 黑体; mso-bidi-font-size: 16.0pt; mso-ascii-font-family: Arial; mso-ansi-language: EN-NZ">:COM" target=_blank>inE-HEIGHT: 173%; mso-bidi-font-size: 16.0pt">

COM" target=_blank>indent2 style="MARGCOM" target=_blank>in: 0cm 0cm 0pt; mso-char-COM" target=_blank>indent-count: 0">本文档详细介绍了编写COM" target=_blank>Outlook COM" target=_blank>Add-COM" target=_blank>in插件的背景知识和开发过程。

COM" target=_blank>indent2 style="MARGCOM" target=_blank>in: 0cm 0cm 0pt; mso-char-COM" target=_blank>indent-count: 0">第一章概述了COM" target=_blank>Outlook COM" target=_blank>Add-COM" target=_blank>in插件的背景知识。

COM" target=_blank>indent2 style="MARGCOM" target=_blank>in: 0cm 0cm 0pt; mso-char-COM" target=_blank>indent-count: 0">第二章详细介绍了COM" target=_blank>Outlook COM" target=_blank>Add-COM" target=_blank>in插件的开发过程。

COM" target=_blank>in: 12pt 0cm; LCOM" target=_blank>inE-HEIGHT: normal">1 " target=_blank>Outlook COM加载项的背景知识

COM" target=_blank>indent style="MARGCOM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.1pt; mso-char-COM" target=_blank>indent-count: 2.0">摘要:本章概述了COM" target=_blank>Outlook COM" target=_blank>Add-COM" target=_blank>in插件的背景知识。

COM" target=_blank>in: 13pt 0cm">1.1. Office 2000 COM加载项

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">COM加载项是可以用于Office 2000的动态连接库(.Dll)。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">COM加载项被明确注册为要通过Office 2000应用程序来加载。因为COM加载项被设计为DLL,所以它们可以在与主控程序相同的进程中运行。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">进程内加载项的好处是,可以有效访问主控程序的对象模型,这使得加载项可以快速地调用方法和属性或接收来自主控程序的事件。

COM" target=_blank>in: 13pt 0cm">1.2. 决定是否要编写COM加载项

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">三个测试问题来帮助你决定是否需要创建COM加载项

COM" target=_blank>in: 0cm 0cm 0pt 42.75pt; TEXT-COM" target=_blank>inDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 42.75pt">COM" target=_blank>ingdCOM" target=_blank>ings; mso-fareast-font-family: WCOM" target=_blank>ingdCOM" target=_blank>ings; mso-bidi-font-family: WCOM" target=_blank>ingdCOM" target=_blank>ings">Ø         在没有运行COM" target=_blank>Outlook客户程序时,你需要接收事件吗?COM加载项的生存期是由COM" target=_blank>Outlook控制的。当COM" target=_blank>Outlook没有运行时,COM加载项不会运行。

COM" target=_blank>in: 0cm 0cm 0pt 42.75pt; TEXT-COM" target=_blank>inDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 42.75pt">COM" target=_blank>ingdCOM" target=_blank>ings; mso-fareast-font-family: WCOM" target=_blank>ingdCOM" target=_blank>ings; mso-bidi-font-family: WCOM" target=_blank>ingdCOM" target=_blank>ings">Ø         性能是我们的应用程序的大问题吗?如果是,应该采用COM加载项,因为它被加载到COM" target=_blank>Outlook进程中。但是注意不要再启动时执行大量查阅或数据检索。

COM" target=_blank>in: 0cm 0cm 0pt 42.75pt; TEXT-COM" target=_blank>inDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 42.75pt">COM" target=_blank>ingdCOM" target=_blank>ings; mso-fareast-font-family: WCOM" target=_blank>ingdCOM" target=_blank>ings; mso-bidi-font-family: WCOM" target=_blank>ingdCOM" target=_blank>ings">Ø         你的应用程序是事件驱动的吗?

COM" target=_blank>in: 13pt 0cm">1.3. COM加载项的注册表设置

COM" target=_blank>in: 13pt 0cm 13pt 21pt; TEXT-COM" target=_blank>inDENT: 21pt">1.3.1.注册加载项

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">只有在正确注册了Office相应应用程序的内部COM插件时,才能被Office应用程序加载上。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">通常,您需要在注册表中创建以下键值:

COM" target=_blank>in: 0cm 0cm 0pt 20.25pt; TEXT-COM" target=_blank>inDENT: 21.75pt">HKEY_CURRENT_USERSoftwareMicrosoftOffice<TheOfficeApp>COM" target=_blank>AddCOM" target=_blank>ins<ProgID>

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">其中,TheOfficeApp表示相应程序名,如:WordCOM" target=_blank>Outlook等,ProgID表示内部COM插件程序的唯一标识符的字符串表示形式,如:COM" target=_blank>Outlook2000COM" target=_blank>AddCOM" target=_blank>in.COM" target=_blank>AddCOM" target=_blank>in等。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">

 

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">如果您希望确保我们的加载项总是被加载,并且每一位用户都可以访问它,那么您必须将加载项ProgID注册到

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">HKLM

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">       Software

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">              MicrosoftOfficeCOM" target=_blank>OutlookCOM" target=_blank>AddCOM" target=_blank>ins

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">键下。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">

 

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">如果您希望用户自己选择是否加载它,那么您可以将加载项ProgID注册到

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">HKCU

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">       Software

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">              MicrosoftOfficeCOM" target=_blank>OutlookCOM" target=_blank>AddCOM" target=_blank>ins

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">键下。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">

 

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">写入键中的信息包括下面的名称/值对:

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">Description(描述) 一个字符串,提供了COM加载项的简短描述。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">FriendlyName(友好名称):一个字符串,是在COM加载项对话框中显示的名称。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">LoadBehavior(加载行为):一个整数的DWORD类型,指定COM加载项的加载方式。0表示断开、1表示连接、2表示启动时加载、8表示需要时加载,以及16表示首次连接。你可以组合不同值来创建不同类型的加载顺序。如,指定3,表示启动和连接时加载。

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">

 

COM" target=_blank>in: 13pt 0cm 13pt 21pt; TEXT-COM" target=_blank>inDENT: 21pt">1.3.2.信任COM加载项

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">通过设置下面的注册表键下的DWORDDontTrustCOM" target=_blank>installedFiles,您可以指定是否信任机器上安装的所有COM加载项

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">HKCU

COM" target=_blank>in: 0cm 0cm 0pt 20.25pt; TEXT-COM" target=_blank>inDENT: 21.75pt">Software

COM" target=_blank>in: 0cm 0cm 0pt 41.25pt; TEXT-COM" target=_blank>inDENT: 21.75pt">MicrosoftOffice9.0

COM" target=_blank>in: 0cm 0cm 0pt 62.25pt; TEXT-COM" target=_blank>inDENT: 21.75pt">COM" target=_blank>OutlookSecurity

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">通过将DontTrustCOM" target=_blank>installedFiles指定为0,您可以指定COM" target=_blank>Outlook信任安装的所有加载项。值1则指定不信任所有的加载项

COM" target=_blank>in: 0cm 0cm 0pt; TEXT-COM" target=_blank>inDENT: 21.75pt">

 

COM" target=_blank>indent style="MARGCOM" target=_blank>in: 0cm 0cm 0pt 24pt">[版权声明:

COM" target=_blank>indent style="MARGCOM" target=_blank>in: 0cm 0cm 0pt 24pt">第一章文字版权归《ProgrammCOM" target=_blank>ing Microsoft COM" target=_blank>Outlook and Exchange》一书所有,该书作者Thomas Rizzo,特此声明]

 

<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>
阅读更多
个人分类: vb
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭