VB6-Loading Autocad Type Library

VB6-Loading Autocad Type Library

Anonymous
Not applicable
1,634 Views
1 Reply
Message 1 of 2

VB6-Loading Autocad Type Library

Anonymous
Not applicable
Within VB6, how do I check which version of AutoCad is running And then load (Project References) the associated AutoCad Type Library???
0 Likes
1,635 Views
1 Reply
Reply (1)
Message 2 of 2

norman.yuan
Mentor
Mentor

Are you talking about VB6, or VBA in AutoCAD?

 

If it is VB6 project (EXE, or DLL taht can be used in VBA or other EXE app), why do you need to load AutoCAD's type library at runtime? Are actually developing some kind of programming language compiling tool that somehow works with AutoCAD together?

 

If you app is to be used inside AutoCAD (as DLL), or to automate/control AutoCAD (EXE), then there is no need to attempt "loading AutoCAD type library": if you use early-binding, the code can only be compiled against one version of AutoCAD type library (this is the only time the type library is needed). If you use late-binding, your code does not need to have reference to AutoCAD type library to be built/compiled. The code will resolve the runtime type automatically (based on Windows registry).

 

To check running AutoCAD version, if your code runs inside AutoCAD (DLL) or as EXE but can get an AcadApplication instanceand then an AcadDocument object, then you can use GetVariable() to check AutoCAD's system variable "ACADVAR".

 

If you app is targeting multiple version of AutoCAD, when using early-binding, the referenced Acad type library should be the oldest version of AutoCAD, and hope latest version of AutoCAD does not break its interface (rare, but could happen every a few years).

Norman Yuan

Drive CAD With Code

EESignature

0 Likes