Calling VB.NET COM Class Library from VB6 ActiveX not working

275 views Asked by At

First of all, I am dealing with a legacy VB6 application that creates "jobs" by calling a (non-ActiveX) C++ DLL that launches (by calling CLSIDFromProgID to point to the class and then launching via CoCreateInstance) various C++/VB6 ActiveX exe's (the jobs are data downloaders of various types). I've had to write a new downloader and since ActiveX is (extremely) legacy, I've written it in VB.NET as a COM Class Library (as VB6 also does not handle stream based HTTP very well if at all) with the same entry point as the other downloaders.

Well the first thing I discovered is that I apparently cannot call the COM library directly (when the launcher calls CoCreateInstance, it triggers the Destructor before resuming with the next statement after the call) so I had to write a VB6 ActiveX exe as a proxy that instantiates the COM (Set oMyObject = CreateObject("DownloaderLib.Loader")) and then just does a 'DoEvents' loop. Calling that from the job handler gives no issues and in my development environment everything all works together and executes nicely.

However, when I move all of the pieces over to my system test environment it breaks down. The VB6 application calls the proxy but the proxy does not seem to load (or at least execute) the COM. I know I am launching the proxy because I have code that "displays" something to an event server; I know it's not reaching the COM because I have similar code in the COM that should dispatch messages at various points inside of it.

I have registered the ActiveX exe proxy and I have registered (with the 'proper' REGASM) the COM Library. My development environment is Win10 using VS2017 with .NET Framework v4.7.03190; the COM is built as a class library with targeting .NET Framework 4.6.1. My system test environment is Windows Server 16 and the .NET Framework installed is 4.7.2 (Release coded 461814) and the REGASM I used is in the folder "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\".

What else would I need to do? What could I be missing?

Any help would be greatly appreciated.

1

There are 1 answers

0
Bob.Seelbach On

@TnTinMn that was the issue. I re-registered with the REGASM under "C:\Windows\Microsoft.NET\Framework\v4.0.30319\" (not Framework64) and it now works!

Thanks very much.