VCProject.CanAddActiveXReference(String, Int32, Int32, Int32, String) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém um valor que indica se a referência do ActiveX (COM) fornecida deve ser adicionada.
public:
bool CanAddActiveXReference(System::String ^ typeLibGuid, int majorVersion, int minorVersion, int localeID, System::String ^ wrapper);
public:
bool CanAddActiveXReference(Platform::String ^ typeLibGuid, int majorVersion, int minorVersion, int localeID, Platform::String ^ wrapper);
bool CanAddActiveXReference(std::wstring const & typeLibGuid, int majorVersion, int minorVersion, int localeID, std::wstring const & wrapper);
[System.Runtime.InteropServices.DispId(845)]
public bool CanAddActiveXReference (string typeLibGuid, int majorVersion, int minorVersion, int localeID, string wrapper);
[<System.Runtime.InteropServices.DispId(845)>]
abstract member CanAddActiveXReference : string * int * int * int * string -> bool
Public Function CanAddActiveXReference (typeLibGuid As String, majorVersion As Integer, minorVersion As Integer, localeID As Integer, wrapper As String) As Boolean
Parâmetros
- typeLibGuid
- String
Uma cadeia de caracteres que representa o GUID da biblioteca de tipos.
- majorVersion
- Int32
Um inteiro que representa o número de versão principal.
- minorVersion
- Int32
Um inteiro que representa o número de versão secundária.
- localeID
- Int32
Um inteiro que representa a ID de localidade.
- wrapper
- String
Uma cadeia de caracteres que representa o nome do wrapper. Pode ficar em branco.
Retornos
true Se ele adicionar a referência ActiveX específica, false se não for.
- Atributos
Exemplos
Consulte como compilar código de exemplo para Visual C++ extensibilidade do modelo de código para obter informações sobre como compilar e executar este exemplo.
CanAddActiveXReference Adiciona uma referência de biblioteca de tipos do ActiveX ao seu projeto com base nos parâmetros que você fornece, se possível.
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