Custom COM class factory for managed in-proc server

假装没事ソ 提交于 2019-12-07 17:22:20

问题


I'm looking at implementing custom COM activation logic for a managed class library, in MkParseDisplayName/BindToObject manner.

This way, creating an object from VB might look like this:

obj = GetObject("clsid:12341234-1234-1234-1234-123412341234:!UniqueObjectId")

That would not be a problem for an out-of-proc server (using CoRegisterClassObject). However, for an in-proc server, I'd need to alter the implementation of DllGetClassObject, which is normally provided by mscoree.dll. Is this possible at all?

The only other option I see is to create a C# singleton object to serve as class factory and implement IParseDisplayName on it. In theory, such singleton could also register a custom IClassFactory class object with CoRegisterClassObject(CLSCTX_INPROC_SERVER), but the singleton itself would need to get instantiated first, anyway.

来源:https://stackoverflow.com/questions/19308027/custom-com-class-factory-for-managed-in-proc-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!