COM访问器方法 [英] COM accessor methods

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

问题描述



我有一个定义访问器函数[propget和propput]的接口.它被命名为DataItem.在实现类的接口中将其实现为get_DataItem和put_DataItem.

要访问这些访问器功能,我应该使用什么名称?

谢谢,
Shishir

Hi,

I have an interface which defines accessor functions [propget and propput]. It is named as DataItem. It is implemented as get_DataItem and put_DataItem in the interface implementing class.

To access these accessor functions, what is the name I should be using ?

Thanks,
Shishir

推荐答案

这取决于您如何调用COM服务器.如果使用VC ++ #import指令,则可以直接使用它为您生成的智能指针类.例如,如果您具有类型为LONG 的属性Bar,则会看到类似以下内容的内容:

It depends on how you are calling the COM server. If you use the VC++ #import directive, you can directly use the smart pointer classes it generates for you. Example, if you have a property of type LONG called Bar, you''ll see something like this:

__declspec(property(get=GetBar,put=PutBar))
long Bar;



这将使您可以通过以下方式直接访问它:



This will let you directly access it as :

object->Bar = 23;
printf("%d\r\n", object->Bar);


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

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