使用OCX而不注册它 [英] Use OCX without registering it

查看:1234
本文介绍了使用OCX而不注册它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在winform上使用ocx(ActiveX控件)(可能是程序添加它),而不先使用regsrv32注册ocx?

Is it possible to use an ocx (ActiveX Control) on a winform (probably adding it programatically) without first having the ocx registered with regsrv32?

m试图实现是启用xcopy安装。我有我的dev机器生成的AxInterop。 .dll和Interop。 .dll文件。

What I'm trying to achieve is to enable xcopy installation. I've had the "AxInterop..dll" and "Interop..dll" file generated from my dev machine.

看到调用COM dll而不首先注册它的可能性( ProSysLib ,但我还没有测试它),因为ocx

I've seen the possibility of calling a COM dll without first registering it (ProSysLib, according to the author, but I haven't tested it yet), since ocx is also COM based, thus I assume that there must be some way to do that as well.

推荐答案

是的,这可以是基于COM的,因此我认为必须有一些方法来做到这一点。完成。您必须假设您的应用程序将仅部署在Windows XP(或Windows Server 2003)或更高版本,然后您可以使用所谓的注册免费COM来实现这一点。

Yes, this can be done. You must assume your application will only be deployed on Windows XP (or Windows Server 2003) or later, and then you can use what is called 'registration free COM' to make this happen.

基本上你所做的是为ActiveX控件DLL创建一个清单文件,所以Windows加载程序& COM DLL知道它的注册是什么,而不必把它放在注册表中。

Essentially what you do is create a manifest file for the ActiveX control DLL so the Windows loader & COM DLL's know what its registration is without having to put that in the registry.

在MSDN上的这篇文章中做一个演练:
免注册激活COM组件:演练

A walkthrough of what to do is in this article on MSDN: Registration-Free Activation of COM Components: A Walkthrough

第6步和第7步中包含您需要的

"Step 6" and "Step 7" in that article contain everything you will need.

刚刚尝试这个在我自己的C#程序之一,使用Microsoft ActiveX网格控件(旧的MS Flex网格),它的工作正常。确保为应用程序和COM DLL创建清单文件,并在正确的位置替换相应的GUID。如果您不方便使用它们,您可能需要使用OLEVIEW来挖掘从ActiveX DLL使用的正确的ID。

I just tried this out on one of my own C# programs that uses a Microsoft ActiveX grid control (the old "MS Flex Grid") and it works just fine. Make sure you create a manifest file for both your application and the COM DLL, and substitute the appropriate GUIDs in the right places. You may need to use OLEVIEW to dig out the right IDs to use from the ActiveX DLL if you don't have them handy.

这篇关于使用OCX而不注册它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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