AddIn 接口

表示**“外接程序管理器”**对话框中列出的外接程序并向其他外接程序对象提供有关外接程序的信息。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
<GuidAttribute("53A87FA1-CE93-48BF-958B-C6DA793C5028")> _
Public Interface AddIn
[GuidAttribute("53A87FA1-CE93-48BF-958B-C6DA793C5028")]
public interface AddIn
[GuidAttribute(L"53A87FA1-CE93-48BF-958B-C6DA793C5028")]
public interface class AddIn
[<GuidAttribute("53A87FA1-CE93-48BF-958B-C6DA793C5028")>]
type AddIn =  interface end
public interface AddIn

AddIn 类型公开以下成员。

属性

  名称 说明
公共属性 Collection 返回包含支持此属性的 AddIn 对象的集合。
公共属性 Connected 获取或设置一个值,该值指示某外接程序是否已加载并连接。
公共属性 Description 获取或设置一个表示 AddIn 对象的说明的字符串。
公共属性 DTE 获取顶级扩展性对象。
公共属性 Guid 获取 AddIn 对象的 GUID。
公共属性 Name 获取 AddIn 对象的名称。
公共属性 Object 获取或设置支持指定的 AddIn 对象的对象。
公共属性 ProgID 获取基于外接程序的注册表项的 ProgID。
公共属性 SatelliteDllPath 如果有,则获取包含本地化资源的 DLL 的位置。

页首

方法

  名称 说明
公共方法 Remove 从外接程序集合中移除外接程序,并使其不可用。

页首

备注

AddIn 对象将有关一个外接程序的信息提供给其他外接程序。 AddIn 对象只表示已注册的外接程序。

示例

Sub AddInExample()
   ' For this example to work correctly, there should be an add-in 
   ' available in the Visual Studio environment.
   ' Set object references.
   Dim addincoll As AddIns
   Dim addinobj As AddIn
   
   ' Register an add-in, check DTE Add-in count before and after the 
   ' Update.
   addincoll = DTE.AddIns
   MsgBox("AddIns collection parent name: " & addincoll.Parent.Name)
   MsgBox("Number of Add-ins: " & addincoll.Count)
   ' NOTE: Use regsvr32 for Visual C++, regasm for Visual Basic 
   ' and Visual C#. Also, the pathname used below is an example only.
   Shell("regasm F:\AddIns\RegExplore\Debug\regexplore.dll")
   addincoll.Update()
   MsgBox("Number of Add-ins: " & addincoll.Count)
   addinobj = addincoll.Item(1)

   ' Connect the add-in if it is not already connected
   ' and list its SatelliteDLLPath and Guid.
   If addinobj.Connected = False Then
      addinobj.Connected = True
   End If
   MsgBox("Satellite DLL Path: " & addinobj.SatelliteDllPath)
   MsgBox("DLL GUID: " & addinobj.Guid)

   ' Activates a solution add-in so that it is available, then 
...' deactivates it.
   addinobj = DTE.Solution.AddIns.Add(addinobj.ProgID, addinobj.Description, addinobj.Name, False)
   DTE.Solution.AddIns.Item(1).Remove()
End Sub 

请参阅

参考

EnvDTE 命名空间