.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Event Handler

4 REPLIES 4
Reply
Message 1 of 5
as
312 Views, 4 Replies

Event Handler

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
4 REPLIES 4
Message 2 of 5
as
in reply to: as

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
Message 3 of 5
as
in reply to: as

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

Harold
Message 4 of 5
ChrisArps
in reply to: as

Try looking at the ObjecARx2006\samples\dotnet\EventsWatcher sample.

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

thanks, i will trie directly tommorow morning

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost