09/12/2012

Preventing AutoCAD from entering a zero doc state

When AutoCAD is in a zero document state, you have very limited access to AutoCAD's functionality. One straightforward method of solving this problem is to prevent AutoCAD from entering the zero document state.

For this, handle the "DocumentCollection.DocumentToBeDestroyed" event, in this event handler; make a call to "ExecuteInApplicationContext" passing a callback. Add a new document, when AutoCAD calls the callback function.

Comments

When AutoCAD is in a zero document state, you have very limited access to AutoCAD's functionality. One straightforward method of solving this problem is to prevent AutoCAD from entering the zero document state.

For this, handle the "DocumentCollection.DocumentToBeDestroyed" event, in this event handler; make a call to "ExecuteInApplicationContext" passing a callback. Add a new document, when AutoCAD calls the callback function.