Use OCX without registering it

自古美人都是妖i 提交于 2019-11-29 20:18:46

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.

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.

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

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

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.

MarkJ

Be warned that apparently using registry-free COM for COM components authored in .NET can randomly cause crashes on Windows XP!

Links: Stackoverflow question where I learned this, Microsoft knowledgebase article referred to in that question. There is a hotfix but you aren't allowed to redistribute it.

It is even a lot simplier in Visual Studio: just go to References, find positions created by your ocx (there should be 2, AxSomething and Something) and set for both of them Isolated: true in their properties. No manifestes, no code. You should now distribute your exe with dll file containing ocx. On your developement machine, the ocx can be registered.

After 10 hours of searching how to run VB6 app with OCX on Win7 without registering it and admin rights, I found few click solution here : http://mmm4vb6.atom5.com/yes-update-0-12-5479.html#c

Need to check Embed Manifest to make it work. Works as charm !

I do post solution here, because I also found this question here.

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