COM 库的属性/方法描述 [英] Property/Method Descriptions for COM Libraries

查看:22
本文介绍了COM 库的属性/方法描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您创建 COMClass,我注意到当您引用生成的 tlb 文件时,XML 摘要标记中的值不会显示在 VB6/VBA 的对象浏览器中.有没有办法显示这些值?

If you create a COMClass, I've noticed that the values in the XML Summary tag do not show in the object browser of VB6/VBA when you reference the resulting tlb file. Is there a way to have these values show up?

推荐答案

不,12 年的 IntelliSense 发展阻止了它的工作.XML 文档注释会生成一个 IntelliSense 可以提取的 .xml 文件.在 VB6/A 中,文档存在于具有帮助字符串属性的类型库中.例如:

No, 12 years of IntelliSense evolution prevents this from working. The XML documentation comments generates an .xml file that IntelliSense can pick up. In VB6/A, documentation is present in the type library with the helpstring attribute. For example:

[
  odl,
  uuid(2334D2B1-713E-11CF-8AE5-00AA00C00905),
  hidden,
  dual,
  nonextensible,
  oleautomation
]
interface IVBDataObject : IDispatch {
    [id(0x00000001), helpstring("Clears all data and formats in a DataObject object."), helpcontext(0x00033693)]
    HRESULT Clear();
    // etc...
};

从 [ComVisible] 类库中获取相同的内容需要 [Description] 属性.请注意this answer,了解它对属性的工作方式.

Getting the same from your [ComVisible] class library requires the [Description] attribute. Note this answer for a quirk about the way it works for properties.

这篇关于COM 库的属性/方法描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆