Поделиться через


VCProject.CanAddActiveXReference - метод

Gets a value indicating whether to add the given ActiveX (COM) reference.

Пространство имен:  Microsoft.VisualStudio.VCProjectEngine
Сборка:  Microsoft.VisualStudio.VCProjectEngine (в Microsoft.VisualStudio.VCProjectEngine.dll)

Синтаксис

'Декларация
Function CanAddActiveXReference ( _
    typeLibGuid As String, _
    majorVersion As Integer, _
    minorVersion As Integer, _
    localeID As Integer, _
    wrapper As String _
) As Boolean
'Применение
Dim instance As VCProject
Dim typeLibGuid As String
Dim majorVersion As Integer
Dim minorVersion As Integer
Dim localeID As Integer
Dim wrapper As String
Dim returnValue As Boolean

returnValue = instance.CanAddActiveXReference(typeLibGuid, _
    majorVersion, minorVersion, localeID, _
    wrapper)
bool CanAddActiveXReference(
    string typeLibGuid,
    int majorVersion,
    int minorVersion,
    int localeID,
    string wrapper
)
bool CanAddActiveXReference(
    [InAttribute] String^ typeLibGuid, 
    [InAttribute] int majorVersion, 
    [InAttribute] int minorVersion, 
    [InAttribute] int localeID, 
    [InAttribute] String^ wrapper
)
function CanAddActiveXReference(
    typeLibGuid : String, 
    majorVersion : int, 
    minorVersion : int, 
    localeID : int, 
    wrapper : String
) : boolean

Параметры

  • typeLibGuid
    Тип: System.String

    A string representing the type library GUID.

  • majorVersion
    Тип: System.Int32

    An integer representing the major version number.

  • minorVersion
    Тип: System.Int32

    An integer representing the minor version number.

  • localeID
    Тип: System.Int32

    An integer representing the locale ID.

  • wrapper
    Тип: System.String

    A string representing the wrapper name. Can be blank.

Возвращаемое значение

Тип: System.Boolean

true if it will add the given ActiveX reference, false if not.

Примеры

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information about how to compile and run this example.

CanAddActiveXReference adds an ActiveX type library reference to your project based on the parameters that you supply, if it is possible.

Imports EnvDTE
Imports System.Diagnostics
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub Test()
        Dim prj As VCProject
        Dim tlguid, wrapper As String
        Dim majver, minver, lcid As Integer

        ' Add the following values:
        ' tlguid = The guid for the EnvDTE COM type library.
        ' wrapper = The wrapper name for EnvDTE, taken from .vcproj file.
        ' majver, minver = The major and minor versions of DTE, 
        '                  taken from the .vcproj file.
        ' lcid = The localization ID. 1033 is English. 
        '        Each language has its own LCID.
        tlguid = "{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}"
        wrapper = "primary"
        majver = 7
        minver = 0
        lcid = 1033
        prj = DTE.Solution.Projects.Item(1).Object
        If prj.CanAddActiveXReference(tlguid, majver, minver, lcid, _
          wrapper) Then
            prj.AddActiveXReference(tlguid, majver, minver, lcid, wrapper)
        Else
            MsgBox("Cannot add the specified ActiveX typelib reference.")
        End If
    End Sub
End Module

Разрешения

  • Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Using Libraries from Partially Trusted Code.

См. также

Ссылки

VCProject Интерфейс

VCProject - члены

Microsoft.VisualStudio.VCProjectEngine - пространство имен