AddIns 接口

包含**“外接程序管理器”**对话框中列出的所有外接程序(如果它们是 DTE.AddIns),或者包含由某个特定解决方案加载的所有外接程序(如果它们是 ProjectSolution.AddIns)。

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

语法

声明
<GuidAttribute("50590801-D13E-4404-80C2-5CA30A4D0EE8")> _
Public Interface AddIns _
    Inherits IEnumerable
[GuidAttribute("50590801-D13E-4404-80C2-5CA30A4D0EE8")]
public interface AddIns : IEnumerable
[GuidAttribute(L"50590801-D13E-4404-80C2-5CA30A4D0EE8")]
public interface class AddIns : IEnumerable
[<GuidAttribute("50590801-D13E-4404-80C2-5CA30A4D0EE8")>]
type AddIns =  
    interface 
        interface IEnumerable 
    end
public interface AddIns extends IEnumerable

AddIns 类型公开以下成员。

属性

  名称 说明
公共属性 Count 获取一个值,该值指示 AddIns 集合中对象的数目。
公共属性 DTE 获取顶级扩展性对象。
公共属性 Parent 获取 AddIns 集合的直接父对象。

页首

方法

  名称 说明
公共方法 Add 将外接程序添加到加载特定解决方案时加载的外接程序集合中。如果该集合是 DTE.AddIns 集合,则该方法失败。
公共方法 GetEnumerator 获取集合中项的枚举数。
公共方法 Item 返回 AddIns 集合中的一个 AddIn 对象。
公共方法 Update 更新集合,如同用户已打开“外接程序管理器”对话框一样,或将对象的窗口布局设置为当前窗口布局。

页首

备注

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

IDTExtensibility2 接口包含 OnAddInsUpdate 方法,只要外接程序不是解决方案外接程序,则在更新 AddIns 集合时会执行该方法。

示例

Sub AddInsExample()
   ' 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)
End Sub 

请参阅

参考

EnvDTE 命名空间