Create AutoCAD reactors

Create AutoCAD reactors

IDSP-gisperfect
Participant Participant
307 Views
0 Replies
Message 1 of 1

Create AutoCAD reactors

IDSP-gisperfect
Participant
Participant

I am using vb.net to create the following AutoCAD reactors:

1. AddHandler Application.DocumentManager.MdiActiveDocument.CommandWillStart, AddressOf docColDocAct
2. AddHandler Application.DocumentManager.MdiActiveDocument.Database.ObjectOpenedForModify, AddressOf callback_ObjectOpenedForModify
3. AddHandler m_ed.SelectionAdded, AddressOf callback_SelectionAdded

Public Sub docColDocAct(ByVal senderObj As Object, ByVal commandarg As CommandEventArgs)
Application.ShowAlertDialog(commandarg.GlobalCommandName.ToString)
Application.ShowAlertDialog(senderObj.ToString)
End Sub

Private Sub callback_ObjectOpenedForModify(ByVal sender As Object, ByVal e As ObjectEventArgs)
WriteLine(String.Format("ObjectOpenedForModify - {0} {1}", e.DBObject.ToString(), e.DBObject.Id.ToString()))
End Sub

Private Sub callback_SelectionAdded(ByVal sender As Object, ByVal e As SelectionAddedEventArgs)
Try
WriteLine(String.Format("SelectionAdded - {0} ssCount:{1} added:{2}", e.Flags, e.Selection.Count, e.AddedObjects.Count))
Catch ex As System.Exception
Application.ShowAlertDialog(ex.Message)
End Try
End Sub

 

The first two reactors are working properly. The third gives an error:

FATAL ERROR: Unhandled Access Violation Reading 0x0000 Exception et 2BD9027Bh

and then AutoCAD crashes.

0 Likes
308 Views
0 Replies
Replies (0)