Waiting for SendCommand

Discussion in 'AutoCAD' started by Nathan Taylor, Oct 7, 2004.

  1. I have been trying to get a solution for using SendCommand in VBA (to allow ghosting of entities when copying, rotating, etc.) that waits for the user to finish the command, prevents cancelling the command and gets newly created objects.

    What I came up with was to have an initial procedure that instantiates an object from a class that contains an EndCommand event handler. The SendCommand is the last line of the initial procedure. When the event handler fires it kicks of a secondary procedure which destroys the object created in the first procedure thus disabling the event handler and runs the rest of the code. To get any newly created objects is as simple as getting a selection set of all objects in the initial and secondary procedures and removing the initial SS from the secondary SS.

    The problem is the user can cancel the command meaning the event handler won't be fired. To prevent the user from being able to cancel the command I worked out I would need to disable the menu, toolbars, toolpalettes & the escape, delete, contol combo & function keys as well as substituting a right mouse button press with an enter key press. I have attached the code I came up with to do it. The DisableInput command is called from the initial procedure and the EnableInput command is called from the secondary procedure.

    I know this is an extreme workaround and I don't think there are any holes in it. I have posted it here as I thought others may find it usefull.

    Regards - Nathan
     
    Nathan Taylor, Oct 7, 2004
    #1
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.