Event Handler

Event Handler

Anonymous
Not applicable
451 Views
4 Replies
Message 1 of 5

Event Handler

Anonymous
Not applicable
I want to create a Event Handler wich starts a routine when a drawing is opened or a new one is created. The .NET dll is loaded with the acad.lsp.

Can somebody give me a hint how to get this started ?

Harold van Aarsen
0 Likes
452 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
This is the code I have created till now:
It gets loaded, give no error on the try, but still gives no response. what can be the error. The promptMessage is a routine that writes to the commandline of autocad.

#Region " Event Handlers "

Friend Function Set_Handlers() As Boolean
Dim db As Database = HostApplicationServices.WorkingDatabase

Try
AddHandler db.DwgFileOpened, New DatabaseIOEventHandler(AddressOf objDwgFileOpened)
PromptMessage("DwgFileOpened Handler added")
Return True

Catch ex As Exception
Message(ex.ToString)
Return False

End Try

End Function

Sub objDwgFileOpened(ByVal sender As Object, ByVal e As DatabaseIOEventArgs)
PromptMessage("Drawing opened !")
End Sub

#End Region
0 Likes
Message 3 of 5

Anonymous
Not applicable
Is there really no one who can help me out, maybe someone who is programming in C# ?

Harold
0 Likes
Message 4 of 5

Anonymous
Not applicable
Try looking at the ObjecARx2006\samples\dotnet\EventsWatcher sample.

That will show you how to handle all events, but it is in C#.
0 Likes
Message 5 of 5

Anonymous
Not applicable
thanks, i will trie directly tommorow morning
0 Likes