Warning: A Tough Question for Experts -- On Debugging VB from AutoCAD

Discussion in 'AutoCAD' started by matt_1ca, Feb 11, 2005.

  1. matt_1ca

    matt_1ca Guest

    Well, this is something tough -- I do not even know if anybody has an answer.

    I want to be able to enter debugging mode in VB when running it from AutoCAD which of course means that the VB is commonly either an EXE or a DLL.

    From source code i.e. IDE that is innate but from AutoCAD -- I do not know it anyone ever experimented on it?

    The closest I can get to it is via an error trapping routine -- otherwise if I dont have an error trapping routine the only message I get before a crash are archaic messages.

    It would be extremely useful if something like that were possible, but then again I do not I want to underestimate the technology we have at this time.

    Would anything like that be possible through an API?

    All answers welcome.

    Matt
     
    matt_1ca, Feb 11, 2005
    #1
  2. Bring up your project properties. On the Debugging tab, make sure "Wait
    for components to be created" is selected. Now set a breakpoint in your
    code and press F5.
     
    Frank Oquendo, Feb 11, 2005
    #2
  3. matt_1ca

    matt_1ca Guest

    Well what can I say -- even I can have a humbling experience once in a while :)

    I tried your answer and it worked like magic, thanks.

    Matt
     
    matt_1ca, Feb 11, 2005
    #3
  4. matt_1ca

    matt_1ca Guest

    Well, I hate to say this but I seem to have spoken too soon again. On closer examination -- F5 does not address my question -- my question was that of being able to enter debug mode of VB from AutoCAD when trying to access EXE as I am having trouble debugging, my conclusion is -- which everybody knows already, you always have to debug from your source code. The only way is to break up your source code as best you can.

    Matt
     
    matt_1ca, Feb 11, 2005
    #4
  5. matt_1ca

    fantum Guest

    fantum, Feb 11, 2005
    #5
  6. There is a way to step into a VB dll project that is in debug mode from
    AutoCAD VBA.
    If that is of interest to you.


    closer examination -- F5 does not address my question -- my question was
    that of being able to enter debug mode of VB from AutoCAD when trying to
    access EXE as I am having trouble debugging, my conclusion is -- which
    everybody knows already, you always have to debug from your source code.
    The only way is to break up your source code as best you can.
     
    Mark Johnston, Feb 11, 2005
    #6
  7. matt_1ca

    matt_1ca Guest

    Not exactly, what I like to do is to have compiled version of my code and also have my source code that corresponds to it open simultaneously in my machine --

    I am hoping that there might be a way such that a crash in that exe code I developed could be automatically intercepted somehow before total collapse of my exe code.

    If it can be done I want to use the error code intercepted so that it can do a stop in my corresponding source code IDE window to automatically point to the location in my source code that misbehaved so I can step through my code and debug it-- the scenario would be that my source code window is minimized and its executable code counter part is the one running activated from AutoCAD prompt using say :

    (vl-vbarun "mama")

    thence from vba code

    sub mama
    dim dblMama
    dblmama=shell("c:\mama.exe")
    end sub

    Personally, I think it cannot be done and I doubt if there is any expert on this planet capable of doing it.

    Matt
     
    matt_1ca, Feb 11, 2005
    #7
  8. Personally, I think it cannot be done and I doubt if there is any expert

    Childish psychology ain´t goint to help you here.
    Grow up man.
    If you need help just ask for it.
     
    Jorge Jimenez, Feb 11, 2005
    #8
  9. matt_1ca

    matt_1ca Guest

    I have closed this question when I said that the only way to do what I am saying is to make a strategic use of dividing your code.

    If anybody disagrees with me, then let him prove me wrong (I guess that is what a discussion is all about). But if he cannot then there is no use watching someone drown and just describe the water. I am disappointed to be reading this very harsh response which does not have anything constructive in it at all. At any rate I wish you well and thank you for taking time to answer.

    I always ask help when I need it.

    Matt
     
    matt_1ca, Feb 11, 2005
    #9
  10. Jorge Jimenez, Feb 11, 2005
    #10
  11. matt_1ca

    matt_1ca Guest

    Thanks for taking the time to answer, that is an interesting concept indeed

    Matt
     
    matt_1ca, Feb 12, 2005
    #11
  12. matt_1ca

    user0 Guest

    Just MHO but I think you should get out more...
     
    user0, Feb 14, 2005
    #12
  13. You can only debug a single instance of your code, be it compiled or
    source. If your component is an executable, simply start it from within
    the IDE and step through as desired. If your component is a dll, use the
    procedure I mentioned earlier.

    These are your only options.
     
    Frank Oquendo, Feb 14, 2005
    #13
  14. matt_1ca

    matt_1ca Guest

    Thanks Frank,

    This gives me clear picture of current limitations.

    Who knows maybe someday someone in this discussion forum can push that limit.

    Matt
     
    matt_1ca, Feb 14, 2005
    #14
  15. matt_1ca

    matt_1ca Guest

    So say my project dll source code is open -- how do I do what you are saying? Hmmmm

    Maybe what you mean is I copy my dll source code into a class in VBA, put it in break mode and step into it line by line.

    Matt
     
    matt_1ca, Feb 15, 2005
    #15
  16. Do as Frank suggests and click the run button on your VB dll project. Select
    Wait for Components . .
    Then open your VBA project in AutoCAD.
    Add a reference to your running VB project. You will want to use the browse
    button and select the VBP file that is your running dll project. Do not
    select the dll. Select the VBP file. You'll need to choose the "All Files"
    filter.
    Once you've added that reference you can call your running dll from your VBA
    code.
    Placing a break in your VB code will let you dig into what's happening on
    the dll side.

    There are a lot of issues to deal with when you do this so be patient.
    For example: if you click the stop button in your VB project you should get
    a warning that other programs reference the code. So, you should remove the
    reference to the running project in VBA before stopping the VB code.
    Also, if you have your dll calling dialogs and interacting with AutoCAD
    there is some wierdness there as to where the dialogs show up.

    Depending on your application you may want to develop as an exe and then
    change the project type to dll.

    it in break mode and step into it line by line.
     
    Mark Johnston, Feb 16, 2005
    #16
  17. matt_1ca

    matt_1ca Guest

    This sounds like a brilliant strategy -- I can't wait to try it out -- thanks Mark, I owe you one.

    Matt
     
    matt_1ca, Feb 17, 2005
    #17
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.