Accurate Monitoring of Drawing Creation, Open, and Close

A tempting technique for monitoring a user's creation, opening, and closing of drawings is to override the AcEditorReactor::commandWillStart() and commandEnded() methods, and to watch for the strings "OPEN", "NEW", "QUIT", and "CLOSE". This practice is prone to error, because drawings can also be opened by other means, such as custom-defined commands, direct MFC, OLE and DDE event handlers, and so on. In fact, these callbacks occur for some Windows ® event handlers, which are not handled by the AutoCAD command processor.

A safer means of monitoring drawing creation, opening, and closing operations is to override reactor callbacks that are directly tied to document or database events, rather than to command events. The following list shows reactor callbacks that you should consider using instead of the AcEditorReactor::commandWillStart() and commandEnded() methods.

For document (edit session) new, open, and close:

For database creation, open, and close:

See the ObjectARX Reference documentation to help you decide which callback is most appropriate for your applications.