Condividi tramite


Metodo VCProject.CanAddActiveXReference

Ottiene un valore che indica se aggiungere il riferimento ActiveX (COM) specificato.

Spazio dei nomi:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Sintassi

'Dichiarazione
Function CanAddActiveXReference ( _
    typeLibGuid As String, _
    majorVersion As Integer, _
    minorVersion As Integer, _
    localeID As Integer, _
    wrapper As String _
) As Boolean
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
)
abstract CanAddActiveXReference : 
        typeLibGuid:string * 
        majorVersion:int * 
        minorVersion:int * 
        localeID:int * 
        wrapper:string -> bool 
function CanAddActiveXReference(
    typeLibGuid : String, 
    majorVersion : int, 
    minorVersion : int, 
    localeID : int, 
    wrapper : String
) : boolean

Parametri

  • typeLibGuid
    Tipo: System.String
    Stringa che rappresenta il GUID della libreria dei tipi.
  • majorVersion
    Tipo: System.Int32
    Intero che rappresenta il numero di versione principale.
  • minorVersion
    Tipo: System.Int32
    Intero che rappresenta il numero di versione secondario.
  • localeID
    Tipo: System.Int32
    Intero che rappresenta l'id delle impostazioni locali
  • wrapper
    Tipo: System.String
    Stringa che rappresenta il nome del wrapper.può essere vuoto.

Valore restituito

Tipo: System.Boolean
true se aggiungere il riferimento ActiveX specificato, false in caso contrario.

Esempi

vedere Procedura: compilare codice di esempio per l'Extensibility del modello di codice di Visual C++ per informazioni su come compilare ed eseguire l'esempio.

CanAddActiveXReference aggiunge un riferimento della libreria dei tipi ActiveX al progetto in base ai parametri che si forniscono, se possibile.

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 .vcxproj file.
        ' majver, minver = The major and minor versions of DTE, 
        '                  taken from the .vcxproj 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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

VCProject Interfaccia

Spazio dei nomi Microsoft.VisualStudio.VCProjectEngine