다음을 통해 공유


VCProject.CanAddActiveXReference 메서드

지정된 ActiveX(COM) 참조를 추가할지 여부를 나타내는 값을 가져옵니다.

네임스페이스:  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
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

매개 변수

  • typeLibGuid
    형식: String

    형식 라이브러리 GUID를 나타내는 문자열입니다.

  • majorVersion
    형식: Int32

    주 버전 번호를 나타내는 정수입니다.

  • minorVersion
    형식: Int32

    부 버전 번호를 나타내는 정수입니다.

  • localeID
    형식: Int32

    로캘 ID를 나타내는 정수입니다.

  • wrapper
    형식: String

    래퍼 이름을 나타내는 문자열입니다. 비어 있을 수 있습니다.

반환 값

형식: Boolean
지정된 ActiveX 참조를 추가하면 true이고, 그렇지 않으면 false입니다.

예제

참고 방법: Visual C++ 코드 모델 확장성에 대한 예제 코드 컴파일 컴파일 및이 예제를 실행 하는 방법에 대 한 내용은.

CanAddActiveXReference가능 하면 사용자가 제공한 매개 변수를 기반으로 프로젝트에 ActiveX 형식 라이브러리 참조를 추가 합니다.

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

.NET Framework 보안

참고 항목

참조

VCProject 인터페이스

Microsoft.VisualStudio.VCProjectEngine 네임스페이스