Is it possible to use an ocx (ActiveX Control) on a winform (probably adding it programatically) without first having the ocx registered with regsrv32?
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.
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.
ocx file must be registered correctly for it to work correctly. The Visual FoxPro Setup Wizard or InstallShield Express in Visual FoxPro 7.0 or a later version of Visual FoxPro will register an .
- Go to Start > Run > Regedit. - Go to Edit > Find... and paste in the value. - Click Find Next to search the registry. Expand the entry and select the InprocServer32 key to reveal the full path to the OCX file.
Click Start > All Programs > Accessories and right-click on "Command Prompt" and select "Run as Administrator" OR in the Search box, type CMD and when cmd.exe appears in your results, right-click on cmd.exe and select "Run as administrator" At the command prompt, enter: REGSVR32 "PATH TO THE DLL FILE"
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With