From: Larsken on
Hello!

I recently finished working on a C# COM dll that gets person info by calling
an intranet web service. This dll is called from a class module inside a VB6
application which then lists the return values back on a form in this
application.

Now I want to call a copy of that fully working dll from an aged VB3
application running on 32-bit Xp clients. The best would of course to rebuild
it from scratch like the C# one, but because the VB3 project source code is
quite extensive and to that a really nightmare with almost no describing
comments at all, it's not a good option. Another drawback is that my
employer's project budget and the development time are limited.

And as a direct call from VB3 exe to the C# dll is not possible, I found
after lots of web search another potential solution on following site,
http://windowsdevcenter.com/pub/a/windows/2005/04/26/create_dll.html. A wise
way to extend and convert a normal VB6 ActiveX dll to work as a normal COM
dll founded on the Win32 API standard features. Based on this excellent
article I made a test project, which worked perfect in VB6, with a strong
hope that this VB6 COM dll could be my bridge between my VB3 calling
functions and the return values back from the C# dll.

After tests both with and without registering (regsvr32) the new VB6 COM dll
in the project folder as in C:\WINDOWS\system32, I still can't make a
connection to it. The LoadLibrary-function gives the error code 21, which
according to http://support.microsoft.com/default.aspx/kb/90753 means
“Application requires Microsoft Windows 32-bit extensions.” when I try to
load it in VB3. When I declare it using late binding and set a object
reference with the CreateObject-function, Dim obj As Object ' Ok!
Set obj = CreateObject("MathLib.Increment"), the result is the MsgBox-error
“OLE Automation server cannot create object.”

So with my time running out I really hope that someone here on this forum
has a good solution on (at first) how to call this VB6 COM dll or another
similar GUI - less object from VB 3.0 ?

Thanks in advance!

Sincerely,

/ Lars-Åke Åkesson, Umeå – Sweden

From: Dee Earley on
On 04/02/2010 14:58, Larsken wrote:
> Hello!
>
> I recently finished working on a C# COM dll that gets person info by calling
> an intranet web service. This dll is called from a class module inside a VB6
> application which then lists the return values back on a form in this
> application.
>
> Now I want to call a copy of that fully working dll from an aged VB3
> application running on 32-bit Xp clients.

Erm, VB3 is 16bit.
You have a vanishingly tiny chance of being able to thunk up to 32-bit
to call .Net.

Your best bet is to bite the bullet and migrate to at least VB4 that has
32-bit support, and ideally to something from this millennium :)

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems
From: Ralph on
Larsken wrote:
> Hello!
>
> I recently finished working on a C# COM dll that gets person info by
> calling an intranet web service. This dll is called from a class
> module inside a VB6 application which then lists the return values
> back on a form in this application.
>
> Now I want to call a copy of that fully working dll from an aged VB3
> application running on 32-bit Xp clients. The best would of course to
> rebuild it from scratch like the C# one, but because the VB3 project
> source code is quite extensive and to that a really nightmare with
> almost no describing comments at all, it's not a good option. Another
> drawback is that my employer's project budget and the development
> time are limited.
>
> And as a direct call from VB3 exe to the C# dll is not possible, I
> found after lots of web search another potential solution on
> following site,
> http://windowsdevcenter.com/pub/a/windows/2005/04/26/create_dll.html.
> A wise way to extend and convert a normal VB6 ActiveX dll to work as
> a normal COM dll founded on the Win32 API standard features. Based on
> this excellent article I made a test project, which worked perfect in
> VB6, with a strong hope that this VB6 COM dll could be my bridge
> between my VB3 calling functions and the return values back from the
> C# dll.
>
> After tests both with and without registering (regsvr32) the new VB6
> COM dll in the project folder as in C:\WINDOWS\system32, I still
> can't make a connection to it. The LoadLibrary-function gives the
> error code 21, which according to
> http://support.microsoft.com/default.aspx/kb/90753 means "Application
> requires Microsoft Windows 32-bit extensions." when I try to load it
> in VB3. When I declare it using late binding and set a object
> reference with the CreateObject-function, Dim obj As Object ' Ok!
> Set obj = CreateObject("MathLib.Increment"), the result is the
> MsgBox-error "OLE Automation server cannot create object."
>
> So with my time running out I really hope that someone here on this
> forum has a good solution on (at first) how to call this VB6 COM dll
> or another similar GUI - less object from VB 3.0 ?
>
> Thanks in advance!
>
> Sincerely,
>
> / Lars-�ke �kesson, Ume� - Sweden


From: Ralph on
Larsken wrote:
<snipped>
>
> So with my time running out I really hope that someone here on this
> forum has a good solution on (at first) how to call this VB6 COM dll
> or another similar GUI - less object from VB 3.0 ?
>

Unfortunately, you are basically SOL! (That is a technical acronym for "bad
news". <g>)

VB3 is 16-bit. VB6 is 32-bit. As all your errors have indicated you can not
attach, link, or use 32-bit components from a 16-bit component, or vice
versa.

Well as nothing in programming is ever totally impossible - you could create
a bridge in C/C++ that could manage it, but it would be a non-trivial
exercise. (To put it mildly. <g>) It isn't clear how far your expertise
goes, but since you said funds and time are limited, and you asked the
question in the first place - I seriously doubt this solution would work for
you. Getting information wouldn't be easy - I did it some 15+ years ago but
have long forgot the nuances.

If you have the source code for the VB3 application then you might rework it
to use files to pass information back and forth. Or some other Rube Goldberg
approach.

But if you have the source code for the VB3 application, I would think
converting it to VB6 would be the better solution. No matter how complex the
code seems - the actual migration after a few scary moments in the beginning
(dealing with changes in DataTypes) would proceed faster than you think. All
the VBs are amazingly back-ward compatible.

So do you have the source code?
How's your C?

-ralph


From: Nobody on
Like others suggested, converting from VB3 to VB6 is easier. I think the
important one being String changed from one to two bytes per character, but
it seems that you have a math library, and converting it shouldn't be a
problem.

Another option is to use some other mechanism for communications, like the
registry or a file, but I believe that converting to VB6 is easier and would
take less time. Please post what this VB3 app does, and how many forms and
libraries or controls it uses, and any 3rd party controls if any.