How to call a VB6 ActiveX COM dll from VB3, both running on Win32? 
Author Message
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

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, its not a good option. Another drawback is that my
employers 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://www.*-*-*.com/
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 cant make a
connection to it. The LoadLibrary-function gives the error code 21, which
according to http://www.*-*-*.com/
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



Mon, 23 Jul 2012 22:58:02 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

Quote:
> 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 :)

--

i-Catcher Development Team

iCode Systems



Mon, 23 Jul 2012 23:08:35 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?
Quote:

> 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



Mon, 23 Jul 2012 23:16:51 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?
<snipped>

Quote:

> 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



Mon, 23 Jul 2012 23:44:05 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?
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.



Tue, 24 Jul 2012 00:28:17 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?
Somewhere in my archive I had some VB3 code that could make API calls to 32
bit libraries (specifically to do the tray icon thing).  I never used it in
production since the move from VB3 to 5 (skipped four) was too close, but it
did work.  That said, I don't think it would work for AX.  You'd probably
need to come up with some C/C++ thunking solution in a "middleman" DLL.  My
question is, why not just upgrade your VB3 code to VB6?  Quciker, easier and
much less of a hassle than what you want to do.


| 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
|



Tue, 24 Jul 2012 01:21:08 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?
Like all said above, upgrade if you can...

But it might be worth the trouble to do it in steps. (If you got VB4,
skip 5 I think and then go 6) My comm line (I dont think that existed
in VB3, but I got one) became a Picture Box and so on, think 3-->4 was
a big step. but that work seems a bit more productive than writing a
wrapper.

If you don't have thousands of VB3 programs all unique and solutions
not complying with modern versions of VB...
Have a hard time to see what that might be... But there is always
one... somewhere. ;)

But to get a computer with a working floppy, as Vb4 did come on 3,5" I
think (lots of them) might be a problem... Or was that the earlier
ones.. Sorry too long ago.

I use a USB floppy (from time to time) intended for a laptop, and yes,
it works, but some of the diskettes (with backup PLC data) doesnt :(

But thats life...

//CY



Tue, 24 Jul 2012 01:37:06 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

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, its not a good option. Another drawback is that my
employers 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 cant 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 ?

See my answer in the Visual Basic .NET forum:

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/6a0d78...

The bottom line is that your COM wrapper to the .NET component will have to be a 32-bit ActiveX EXE
- you cannot run a 32-bit DLL in a 16-bit process space.

Or, the alternative is to upgrade your VB app to 32-bit as others have mentioned.

Paul
~~~~
Microsoft MVP (Visual Basic)



Tue, 24 Jul 2012 02:18:16 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

Quote:

> 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 ?

The problem you're having is that you're trying to load a 32-bit
library into a 16-bit process.  Cut out a few words in that last
sentence, to the *critical* part: "in-process".  No can do.

Create the 32-bit COM server as an ActiveX EXE, which will run
"out-of-process", and this approach should fly.  (I hope I haven't just
ruined your "can't be done" excuse for rewriting the whole project?
<g>)

Have fun...   Karl

--
.NET: It's About Trust!
http://vfred.mvps.org



Tue, 24 Jul 2012 02:32:38 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

Quote:

> The bottom line is that your COM wrapper to the .NET component will have to
> be a 32-bit ActiveX EXE - you cannot run a 32-bit DLL in a 16-bit process
> space.

Beat me to it.  Your response appeared right as I hit Send on mine.  
Scary, huh? <g>

Quote:
> Or, the alternative is to upgrade your VB app to 32-bit as others have
> mentioned.

The out of process approach is ugly, no doubt.  Particularly if someone
decides to upgrade their system to x64.  In that case, this band-aid
won't stop the hemorrhage.

--
.NET: It's About Trust!
http://vfred.mvps.org



Tue, 24 Jul 2012 02:35:28 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

Quote:

> Like all said above, upgrade if you can...

> But it might be worth the trouble to do it in steps. (If you got VB4,
> skip 5 I think and then go 6) My comm line (I dont think that existed
> in VB3, but I got one) became a Picture Box and so on, think 3-->4 was
> a big step. but that work seems a bit more productive than writing a
> wrapper.

My first reaction was that would be a waste of time, BUT on further
reflection - assuming the OP had or could obtain a full copy of VB4 - it did
include a 'upgrade' tool to convert VB3 to VB4 - that would probably save
some time. VB4 at least still recognized the older controls etc. Popping VB3
into VB6 would likely be a greater adventure, than working with VB4.

Something else... I've forgot just when, but didn't one have to deliberately
save VB 'source' files as text, otherwise VB saved its files in a binary
format. I doubt those old pcode files would load into VB6 (????).

-ralph



Tue, 24 Jul 2012 02:37:47 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

Quote:


>> 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 ?

> The problem you're having is that you're trying to load a 32-bit
> library into a 16-bit process.  Cut out a few words in that last
> sentence, to the *critical* part: "in-process".  No can do.

> Create the 32-bit COM server as an ActiveX EXE, which will run
> "out-of-process", and this approach should fly.  (I hope I haven't
> just ruined your "can't be done" excuse for rewriting the whole
> project? <g>)

He would still SOL, so you haven't ruined a thing.

Late or early binding, IUnknown or IDispatch (Automation), Standard DLL or
ActiveX - 16-bit can't talk to 32-bit without a custom mediator, or
indirectly through system services (Registry, files, etc).

-ralph



Tue, 24 Jul 2012 02:51:49 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

Quote:



>>> 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 ?

>> The problem you're having is that you're trying to load a 32-bit
>> library into a 16-bit process.  Cut out a few words in that last
>> sentence, to the *critical* part: "in-process".  No can do.

>> Create the 32-bit COM server as an ActiveX EXE, which will run
>> "out-of-process", and this approach should fly.  (I hope I haven't
>> just ruined your "can't be done" excuse for rewriting the whole
>> project? <g>)

> He would still SOL, so you haven't ruined a thing.

> Late or early binding, IUnknown or IDispatch (Automation), Standard DLL or
> ActiveX - 16-bit can't talk to 32-bit without a custom mediator, or
> indirectly through system services (Registry, files, etc).

I've had no problem talking to a 16-bit ActiveX EXE from a 32-bit app.  
Why would it be more difficult to go the other way?  Isn't COM the
mediator?

--
.NET: It's About Trust!
http://vfred.mvps.org



Tue, 24 Jul 2012 03:15:48 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?

Quote:

> My first reaction was that would be a waste of time, BUT on further
> reflection - assuming the OP had or could obtain a full copy of VB4 - it did
> include a 'upgrade' tool to convert VB3 to VB4 - that would probably save
> some time. VB4 at least still recognized the older controls etc. Popping VB3
> into VB6 would likely be a greater adventure, than working with VB4.

I actually found a shrinkwrapped copy of VB4EE the other day, in a
closet, and was wondering if it might still have any value.

Quote:
> Something else... I've forgot just when, but didn't one have to deliberately
> save VB 'source' files as text, otherwise VB saved its files in a binary
> format. I doubt those old pcode files would load into VB6 (????).

Yeah, I fired up VB3 the other day, and saw that the options still used
binary by default.  So it definitely had to be toggled to text there.

--
.NET: It's About Trust!
http://vfred.mvps.org



Tue, 24 Jul 2012 03:17:34 GMT  
 How to call a VB6 ActiveX COM dll from VB3, both running on Win32?


>> 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 ?
>
> The problem you're having is that you're trying to load a 32-bit
> library into a 16-bit process.  Cut out a few words in that last
> sentence, to the *critical* part: "in-process".  No can do.
>
> Create the 32-bit COM server as an ActiveX EXE, which will run
> "out-of-process", and this approach should fly.  (I hope I haven't
> just ruined your "can't be done" excuse for rewriting the whole
> project? <g>)
>

He would still SOL, so you haven't ruined a thing.

Late or early binding, IUnknown or IDispatch (Automation), Standard DLL or
ActiveX - 16-bit can't talk to 32-bit without a custom mediator, or
indirectly through system services (Registry, files, etc).

-ralph

Not really sure what you're getting at. I used to use this COM out of process thunking mechanism all
the time back in the days of 16 and 32-bit VB 4.0, especially when I needed to use a 16-bit DLL
library. As a matter of fact I distinctly remember automating 32-bit Office apps from 16-bit VB.

Paul
~~~~
Microsoft MVP (Visual Basic)



Tue, 24 Jul 2012 03:18:43 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. COM DLL calling external non-COM DLL problem.

2. calling activex dll in c++ COM

3. Wrapping vb.NET Windows contol library dll as COM ActiveX control for use in VB6

4. TIP: Running VB6 ActiveX DLLs on IIS 4.0

5. Call VB DLL or COM object from within VB COM object or EXE

6. Can ActiveX controls make win32 API calls?

7. VB6 and Win32 API calls

8. Need Win32 API Calls to find Handle of a Program Running in Windows95

9. SPEED: VB5 ActiveX DLL vs C++ ATL COM DLL

10. WIn32 API call from VB6

11. Calling Win32 DLLs from VB 3.0

12. Calling a win32 DLL in a vb app - Need help

 

 
Powered by phpBB® Forum Software