How can I dynamically instantiate an ActiveX control from an .ocx file?

自作多情 提交于 2019-12-12 03:19:22

问题


I would like to create an instance of an ActiveX control. Given the .ocx file and interface definitions in C#, how can I do this? I don't mean the usual way of adding a reference to the project because I want to avoid the need for registering the control globally on the target system.


回答1:


This looks like you should check into Registration-free COM. Beware that this does not work on older systems IIRC.

For some details/samples etc. see:

  • http://msdn.microsoft.com/en-us/library/fh1h056h.aspx
  • http://blogs.msdn.com/b/junfeng/archive/2006/04/20/579748.aspx
  • http://apocryph.org/2010/05/23/getting-reg-free-com-activation-working-between-managed-and-unmanaged-dlls/
  • http://dotnetforum.net/topic/21006-manifest-resource-refference-in-c-net-application-com-reg-free-instantiation/
  • http://www.codeproject.com/Articles/13391/Using-IFilter-in-C


来源:https://stackoverflow.com/questions/8974423/how-can-i-dynamically-instantiate-an-activex-control-from-an-ocx-file

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