Use OCX without registering it(无需注册即可使用 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?
我想要实现的是启用 xcopy 安装.我的开发机器生成了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 也是基于 COM 的,因此我认为也必须有某种方法来做到这一点.
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.
推荐答案
是的,可以这样做.您必须假设您的应用程序将仅部署在 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.
我刚刚在我自己的一个使用 Microsoft ActiveX 网格控件(旧的MS Flex Grid")的 C# 程序上进行了尝试,它工作得很好.确保为应用程序和 COM DLL 创建清单文件,并在正确的位置替换适当的 GUID.如果手头没有这些 ID,您可能需要使用 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无需注册即可使用 OCX
基础教程推荐
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01