acad2000 vs 2004 lib ref

Discussion in 'AutoCAD' started by Mark Propst, Apr 30, 2004.

  1. Mark Propst

    Mark Propst Guest

    win2k
    both 2002 and 2004 installed

    vb project with a reference to acad2004 lib
    acad2002 running

    this line returns error
    Set moAcad = GetObject(, "AutoCAD.Application")

    how to make version agnostic?
     
    Mark Propst, Apr 30, 2004
    #1
  2. You can't do this, because GetObject() is
    looking for a running instance of AutoCAD,
    using the curver setting in the registry,
    which is set to AutoCAD 2002 when its started.
     
    Tony Tanzillo, May 2, 2004
    #2
  3. Mark Propst

    Mark Propst Guest

    so i need two versions of any given project - one that references 2002 and
    the other that refs 2004 or 5 etc?

    or would this work?
    On Error Resume Next
    Set moAcad = GetObject(, "AutoCAD.Application")
    If err then
    err.clear
    Set moAcad = GetObject(, "AutoCAD.Application16")'or whatever the
    right reference is
    If err then
    err.clear
    Set moAcad = GetObject(, "AutoCAD.Application1X")'etc

    ....probably not if the 2004 lib is referenced and 2002 is running.
    And i'm sure it wouldn't work if 2002 was referenced and 2004 was running.

    so is that a reason to not reference libs and use late binding?
    in which case the on error thing above might work?
     
    Mark Propst, May 2, 2004
    #3
  4. Mark - If one is running, you are probably stuck.

    You will probably need 2 versions of your app.
     
    Tony Tanzillo, May 2, 2004
    #4
  5. Mark Propst

    Mark Propst Guest

    Thanks

     
    Mark Propst, May 2, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.