问题
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