VCActiveXReference.ControlGUID 属性

获取选定 ActiveX 引用的 GUID。

命名空间:  Microsoft.VisualStudio.VCProjectEngine
程序集:  Microsoft.VisualStudio.VCProjectEngine(在 Microsoft.VisualStudio.VCProjectEngine.dll 中)

语法

声明
ReadOnly Property ControlGUID As String
string ControlGUID { get; }
property String^ ControlGUID {
    String^ get ();
}
abstract ControlGUID : string with get
function get ControlGUID () : String

属性值

类型:System.String
选定的 ActiveX 引用的 GUID 值。

备注

有关如何编译和运行此示例的信息,请参见如何:编译 Visual C++ 代码模型扩展性的示例代码

示例

循环通过在解决方案中的每个项目并列出每个 ActiveX (com) 控件 GUID。

' Add a reference to Microsoft.VisualStudio.VCProjectEngine and have a 
' Visual C++ project loaded before running this example. Also, you 
' should have at least one ActiveX (COM) reference in a project.
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
    Sub Test()
        Dim proj As Project
        Dim vcproj As VCProject
        Dim ref As VCReference
        Dim axref As VCActiveXReference
     
        On Error Resume Next

        ' Loop each project in the solution.
        For Each proj In DTE.Solution.Projects
            vcproj = Nothing
            vcproj = CType(proj.Object, VCProject)
            ' If this project is a Visual C++ project
            If Not vcproj Is Nothing Then
                ' Loop the references for this Visual C++ project
                For Each ref In vcproj.VCReferences
                    axref = Nothing
                    axref = CType(ref, VCActiveXReference)
                    ' If this reference is an ActiveX reference
                    If Not axref Is Nothing Then
                        MsgBox("Control GUID: " & axref.ControlGUID)
                    End If
                Next
            End If
        Next
    End Sub
End Module

.NET Framework 安全性

请参见

参考

VCActiveXReference 接口

Microsoft.VisualStudio.VCProjectEngine 命名空间