|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
COM Interop Error on 64 bit OSI have a VB6 executable that references a .NET 2.0 dll.
The .NET 2.0 dll project has 'Register for COM Interop' checked. Thus, compiling the dll will generate the .tlb file. This will allow early binding to work from VB6. I copied the VB6 exe and the .NET dll to a 32 bit OS. I copied the tlb file to system32. When I execute the VB6 exe and call the .NET dll it works fine. NOW, if I copy the VB6 exe and the .NET dll to a 64 bit OS and execute it, I get the 'ActiveX cannot create object' error. I tried both, early and late binding but I keep getting the same error. If I call the .NET dll from another .NET app on a 64 OS, it works fine. Is there anything different that I would have to do in order to get the VB6 application to call a .NET dll while running on a 64 bit OS? -- ANeelima Hi ANeelima,
After exporting a type library for .NET assembly, you will need to register it in the registry. Regasm.exe does both for us. Are you copying the .dll to a 64bit OS and register it with regasm.exe? If so, on a 32bit system all works fine. However, on a 64bit system, regasm export and register the assemly as 64 bit and write to the keys in 64 bit registry. The VB6 .exe is a 32bit app, and running on WOW64, it cannot see the 64bit registry. That's why the error is generated. On a 64bit system, you have to do more steps: 1. Export a type library using tlbexp.exe with /win32 to force to generates a 32-bit type library. http://msdn2.microsoft.com/en-us/library/hfzzah2c(VS.80).aspx 2. Use regtlb.exe to register the type library. The RegTlb tool requires a pre-existing TLB, but it is not a standard tool included in any SDK, tool or system I know of, but just a sample program: http://msdn.microsoft.com/library/en-us/dncomg/html/dcomtyplib.asp You can download the pre-built RegTlb from the following link: http://www.freevbcode.com/ShowCode.Asp?ID=2195 Please also check the following link for more info. http://groups.google.com/group/microsoft.public.dotnet.framework.interop/bro wse_thread/thread/9bfaa79d9bcf48d9/83f34e9241058ac0?lnk=st&q=regtlb&rnum=1#8 3f34e9241058ac0 If anything is unclear, please feel free to let me know. Kevin Yu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) |
|||||||||||||||||||||||