如何控制在运行对象表上注册的com调度对象的引用计数? [英] How to control refcount of a com dispatch object registered on the running object table?
问题描述
大家好,
为了能够使用vb6中的getobject来访问用c#在com exe服务器上管理的com对象,我可以使用RegisterActiveObject方法来访问此对象.
唯一的问题是何时需要关闭com exe服务器?
万一vb6应用程序正在使用createobject,我可以在IClassFactory :: CreateInstance()调用中增加我的对象引用计数器.这将告诉我该对象当前有多少个引用处于活动状态.
当vb6应用程序正在调用时:设置myobject = none,
在C#中是否可以实现标准IUnknown接口或如何捕获对象的IUnknown :: release函数以减少引用计数器?
非常感谢您的投入.
最好的问候.
Hello Everyone,
To be able to use getobject from vb6 to access a com object managed on a com exe server in c#, I can use the RegisterActiveObject method to give access to this object.
The only problem is when I need to close the com exe server?
In case, the vb6 application is using createobject, I can in the IClassFactory::CreateInstance() call, increase my object reference counter. This will tell me how many references are currently active on this object.
When the vb6 application is invoking: set myobject = nothing,
is there a way in c# to implement the standard IUnknown interface or how to catch the IUnknown::release function of my object to decrease the refence counter ?
Thank you very in advance for your inputs.
Best regards.
推荐答案
您永远不需要在C#中执行此操作.如果您解释要实现的目标,我们可以进一步讨论.
—SA
You never need to do it in C#. We could discuss further detail if you explain what do you want to achieve.
—SA
这篇关于如何控制在运行对象表上注册的com调度对象的引用计数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!