Skip to content

GetDeclaredTypeProgId

返回与已声明类型关联的COM ProgID,在编译时解析。

语法:GetDeclaredTypeProgId(Of T )() As String

T
必需 要查询的类型。通常是使用CoClassId属性声明的coclass或从类型库导入的类型。

ProgID是可读名称(Application.ObjectScripting.Dictionary等),在注册表中与T的CLSID匹配。查找在编译时进行,结果作为字符串字面值存储在生成的代码中——没有运行时调用。

如果类型没有关联的ProgID,则返回空字符串。

示例

vb
Dim Id As String = GetDeclaredTypeProgId(Of MyApp.Document)()
Debug.Print Id                       ' "MyApp.Document"

另请参阅

twinBASIC及其LOGO版权为作者"韦恩"所有