Several methods as alluded to above
You didn't say what language so I'll provide VB.Net
First you need to capture the document collection. To make use of the existing events, simply declare the variable WithEvents like so (public or private as the case warrants) You will need to make it a global variable within your class(s)
Private WithEvents docManager = Autodesk.AutoCAD.ApplicationServices.DocumentCollection
Now you can capture document events like this:
Private Sub docManager_DocumentActivated(sender as Object, e As DocumentCollectionEventArgs) Handles docManager.DocumentActivated
'DoStuffHere
End Sub
Private Sub docManager_DocumentCreated(sender as Object, e As DocumentCollectionEventArgs) Handles docManager.DocumentCreated
'DoStuffHere
End Sub