VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoCAD 2014 and using GetInterfaceObject to VB6 Active X DLL

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
rendermg
2289 Views, 2 Replies

AutoCAD 2014 and using GetInterfaceObject to VB6 Active X DLL

Hello all,

 

My guess is this isn't possible but I want to seek some advice from the experts.

 

We have some legacy VB6 applications and DLLs that interface currently with AutoCAD 2008 on WinXP, and due to the ending support of XP we are now migrating our user base to Win7 (x64) and AutoCAD 2014. 

 

To give a basic idea of what the old legacy code did:

Our VB6 EXE -> calling a function in our referenced VB6 DLL which launches and connects to autocad->create in proc to another VB6 DLL (created by us)

Small code snippets:

- Start ACAD via create process, attach to it via: Set oApp = GetObject(, "AutoCAD.Application")

- Create In proc to another VB6 DLL  via: oApp.GetInterfaceObject("OurVB6DLL.OurVB6Class")

- Do what we needed while running inside of ACAD process space

 

As we've attempted to migrate this to Win7 x64 bit - AutoCAD 2014. I have created the vb6 dlls referencing the AutoCAD Type Library, and needed references. I have built these VB6 exe's/dll's in VB6 IDE on Win7 x64 bit.

 

I know the VB6 Exe's and DLL's are still 32 bit, and I have registered the 32 bit DLL's with regsvr32.exe from SysWOW64.

 

Now when executing the application in Win7 x64 bit with AutoCAD 2014 the code is able to launch and attach to the AutoCAD 2014 instance, but when we execute the GetInterfaceObject call it doesn't return anything, and if you execute same call in VB6 debugger (immediate window) the "Problem in loading application" error message appears. 

 

I've also built a test application in .NET that does the same thing (launches, attaches, and tries to get the interface object of a VB6 ActiveX DLL), and the exeception throwin is: [System.Runtime.InteropServices.COMException] = {"Problem in loading application"}

 

So the real question I am getting at here is: Is it even possible to have AutoCAD x64 bit getInterfaceObject on (VB6 32 bit active X dll)?

 

I am familar with the introduction of VBA 7.1 for AutoCAD 2014, which now you can create VBA that is 64 bit in this environment, but I am wondering if that means VBA must be 64 bit? And does that mean you cannot interface with the old VB6 32 bit active X dll?

 

If it is not possible what other suggestions would you have (aside from strickly migrating to .NET)?

 

Any comments are welcome, Thanks.

 

2 REPLIES 2
Message 2 of 3
norman.yuan
in reply to: rendermg

AcadApplication.GetInterfaceObject() loads components into AutoCAD process. Therefore, no, you cannot have 64-bit AutoCAD to load components from 32-bit DLLs.

 

If you have to use VBA in AutoCAD Map 2014, you'll need to copy the code in the 32-bit VB DLL project into AutoCAD 2014 VBA and run it as pure VBA project. Hopefully the original code has no dependency to  other 32-bit components.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3
rendermg
in reply to: norman.yuan

Thanks for the quick reply Norman.

 

I'm actually not using AutoCAD MAP -> It is AutoCAD Electrical, but that really doesn't matter as you have answered my question.

 

And unfortuntely the VB6 32 bit DLL has a signficant amount of other 32 bit dependencies. It looks like there is no way to use GetInterfaceObject the way we used to and run this code within the AutoCAD process space. 

 

Therefore, I will take a different route. 

 

Thanks again.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost