如何正确隐藏智能感知的方法和属性
有人知道如何从智能感知中正确隐藏类、方法和属性,同时保留调用它们的能力吗?因此它们不会出现在从类型库生成的互操作程序集中?
我正在为自动化测试编写 API 挂钩,但我们还不想暴露给消费者。这似乎在我们的应用程序附带的内置 SaxBasic 编辑器中运行良好,但在将引用添加到我们的互操作程序集中时无法隐藏对象、方法和属性。
这是我如何尝试隐藏这些的示例;各种排列都试过了,先谢谢了!
[
object,
uuid(guid),
helpstring("help"),
version(ver),
dual,
nonextensible,
oleautomation,
pointer_default(unique)
]IApplication.VisibleObj
interface IObj : IDispatch
{
//tried [hidden] here, no luck
[propget, id(91001), helpstring("Help str. Available as of Object Model Version X.X.X."), hidden]//again tried [hidden] here, no luck
HRESULT Obj([out, retval] IObj** ppObj);
}
Would anyone know how to properly hide classes, methods and properties from intellisense while preserving the ability to call them; and so they do not appear in interop assemblies that are generated from a type library?
I'm writing API hooks for automated testing we don't want exposed to consumers yet. This appears to work well from the built in SaxBasic editor our application comes with, but fails to hide the objects, methods and properties when a reference is added to our interop assembly.
Here's an example of how I'm attempting to hide these; various permutations have been tried, thanks in advance!
[
object,
uuid(guid),
helpstring("help"),
version(ver),
dual,
nonextensible,
oleautomation,
pointer_default(unique)
]IApplication.VisibleObj
interface IObj : IDispatch
{
//tried [hidden] here, no luck
[propget, id(91001), helpstring("Help str. Available as of Object Model Version X.X.X."), hidden]//again tried [hidden] here, no luck
HRESULT Obj([out, retval] IObj** ppObj);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Visual Studio 2008 和 2010 现在似乎忽略了“隐藏”属性,使原本隐藏的界面变得可浏览。
看来互操作程序集必须通过修饰以下类、方法和属性来修改,这些类、方法和属性旨在存在但不可浏览:
来源:http://www.summsoft.com/blogs/garyvsta/archive/2009/ 02/06/preserving-hidden-elements-in-a-com-interop- assembly.aspx
It appears Visual Studio 2008 and 2010 now ignore the 'hidden' attribute, making otherwise hidden interfaces browseable.
It appears the interop assembly must be modified by adorning the following over classes, methods and properties that are intended to exist but not be browseable:
Source: http://www.summsoft.com/blogs/garyvsta/archive/2009/02/06/preserving-hidden-elements-in-a-com-interop-assembly.aspx