Autocad's Version

Discussion in 'AutoCAD' started by giggio, Mar 25, 2005.

  1. giggio

    giggio Guest

    Help me...
    I have a vb6's application that use "autocad 202 lybrary"
    If customers have Autocad 2004 I must change library from references by VB6... then i must compile the project and change the file .exe.....
    is there a way in order to avoid it?
    Thanks!!!
     
    giggio, Mar 25, 2005
    #1
  2. Don't early bind, remove the reference and dim acadapp as object.

    Terry
     
    Terry W. Dotson, Mar 25, 2005
    #2
  3. Don't early bind, remove the reference and dim acadapp as object.
    Anything specifically declared as an AutoCAD object needs to be an object -
    AcadLine, AcadCircle, etc.

    Terry knows that, I'm just "fine" tuning the response

    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Mar 26, 2005
    #3
  4. giggio

    bcoward Guest

    James,

    The difference can be significant but what is significant?

    You may or may not see any perf hit but this is what kind of happens....

    You have an obj var explicitly defined and another defined as an object. When the compiler gets to your variable as Acadobj there is a direct path in the gizzards that tells everything how to work together, what methods, properties, etc will be exposed by this object. You will also have Intelliscense displayed when using explicit variable references.

    When you have defined your object variable as object the complier has to make memory space for an undefined object so that once it is defined it has a placemat to contain the object. Only then will it recognize this objects properties, methods, etc and thus the specific error message telling you something isn't known.

    During your progam execution your app can also be going through an identity crisis until it figures it out. Very much how GetObject and CreatObject figure out what to do by going through the registry hive down to clsid etc.

    I dired this out and it isn't exactly correct...hope it greases the cogs.

    Good luck,

    Bob Coward
    CADS, Inc

    800-366-0946

    CADS, inc
     
    bcoward, Mar 26, 2005
    #4
  5. giggio

    James Allen Guest

    Hi Terry and Mike,

    I've been wondering about this as I'm relatively new to vba, but basically
    aware of early vs. late binding. I've seen people explain that you get
    performance benefits with early binding. This makes sense, but is the
    difference significant? And is the difference only in load time, or run
    time as well?

    Thank you,
     
    James Allen, Mar 26, 2005
    #5
  6. You greased it good to me, Bob =)

    James, you typically do not use late binding with vba, though. It is used
    with non-hosted languages - vb, c#, etc.

    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Mar 26, 2005
    #6
  7. giggio

    James Allen Guest

    Thank you both, Bob and Mike.

    Mike, would vba also be considered non-hosted when it is accessing an
    external application (like accessing Excel from AutoCAD)? My work in vba so
    far is almost exclusively early bound. But I wished I had used late binding
    when we upgraded versions of Excel and I had to go through and update
    references to the new library. I think maybe that was when I became aware
    of the concept. But I've been branching out a little more lately and
    wondered if I should be using more late binding when controlling other apps
    from acad. I've also wondered about the merits of designing and debugging
    code with early binding and then converting it to late binding for
    production code to avoid that kind of upgrade issue.

    Thanks to both of you for the extra info.

    James
     
    James Allen, Mar 26, 2005
    #7
  8. Mike, would vba also be considered non-hosted when it is accessing an
    Yes, James, that assumption is correct. I've been writing stand alone for
    so long, I forgot about someone calling from another app like excel or
    access

    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Mar 27, 2005
    #8
  9. giggio

    James Allen Guest

    Thanks again Mike.

    James


     
    James Allen, Mar 27, 2005
    #9
  10. giggio

    Joe Sutphin Guest

    There is no point late binding when using VBA.

    Joe
    --
     
    Joe Sutphin, Mar 27, 2005
    #10
  11. giggio

    rwilkins Guest

    As Joe stated,

    There is no need to late bind in VBA. That is as long as when you save the VBA .dvb file, it is saved in the earliest version of AutoCAD that will be using it and with references to the earliest type libraries you might need to use.

    For example:
    1. The .dvb file will be used in 2002, 2004, 2005, and 2006.
    2. You will be using Excel 2000, 2002(XP), and 2003.

    You will want to write and save the .dvb file while working in AutoCAD 2002. If you open the VBA file in 2006 and save, then someone using 2002 tries to run the file, they most likely will get an error regarding missing type library. Same thing if you save the .dvb while it's referencing Excel 2003 and someone who only has Excel 2000 tries to run the program.

    Because VBA is compiled at runtime, the needed type libraries will, for the most part, automatically update the latest version. They will not however, downgrade to an earlier version.
     
    rwilkins, Mar 29, 2005
    #11
  12. How did it get to this point, the original poster said they were using VB6.

    Terry
     
    Terry W. Dotson, Mar 30, 2005
    #12
  13. giggio

    Joe Sutphin Guest

    Read all the posts and voila ...

     
    Joe Sutphin, Apr 4, 2005
    #13
  14. I have the feeling that people who use Outlook
    and other newreaders, like myself
    are not getting all the post in this NG
     
    Jorge Jimenez, Apr 4, 2005
    #14
  15. giggio

    Joe Sutphin Guest

    Maybe, I never use anything but Outlook Express for viewing newsgroups.

    Joe
    --
     
    Joe Sutphin, Apr 4, 2005
    #15
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.