Prev: Problem updating Service reference
Next: How to use the WebBrowser control to open an Office document
From: C. Kevin Provance on 4 Feb 2010 12:21 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. "Larsken" <Larsken(a)discussions.microsoft.com> wrote in message news:7C98E2E8-1CCE-41CB-A540-6D655CA0A17B(a)microsoft.com... | 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: CY on 4 Feb 2010 12:37 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
From: Paul Clement on 4 Feb 2010 13:18 On Thu, 4 Feb 2010 06:58:02 -0800, Larsken <Larsken(a)discussions.microsoft.com> 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 ? � See my answer in the Visual Basic .NET forum: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/6a0d7875-7b43-4bb5-969a-72871be7646b 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)
From: Karl E. Peterson on 4 Feb 2010 13:32 Larsken wrote: > 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
From: Karl E. Peterson on 4 Feb 2010 13:35
Paul Clement wrote: > 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> > 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 |