Valued Mentor
411 Posts
29 Kudos
Registered: ‎01-27-2010
Post 1 of 3

Catching a Righ Click but Autocad got nuts

216 Views, 2 Replies
09-04-2012 05:53 AM
Private Class JigFilter
        Implements System.Windows.Forms.IMessageFilter

        Private  WM_LBUTTONDOWN = As Integer = &H201
        Private WM_LBUTTONUP As Integer = &H202
        Private WM_RBUTTONDOWN As Integer = &H204
        Private WM_RBUTTONUP As Integer = &H205

        Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean _
                         Implements System.Windows.Forms.IMessageFilter.PreFilterMessage
            If m.Msg = WM_RBUTTONDOWN Then
                'Dim doc As Document = Application.DocumentManager.MdiActiveDocument()
                'Dim ed As Editor = doc.Editor()
                'ed.WriteMessage(vbCrLf + "Right Button pressed!!")
                If _toggleRotation = False Then
                    _toggleRotation = True
                    _posRotation = _position
                    _angle = Entite.Rotation
                    _toggleRotation = False
                End If
                Return True
            End If
            Return False
        End Function

    End Class

 He all.

I use a code for catching the right click mousse.


It work fine in my computer but i have installed on other Pc and when right click  occur autocad launch  a other command...   The command is random....

I dunno why ??


here the code New and the Run of my jig.


    '**** SUB NEW ************************
    Sub New(ByRef Doc As Document, ByRef tr As Transaction, ByRef db As Database, ByRef ent As Entity)

        Entite = Entity
        _filter = New JigFilter


        _Doc = Doc
        _db = db
        _tr = tr
        _angle = 0

        _txtSize = 12 
_alignH = TextHorizontalMode.TextCenter _alignV = TextVerticalMode.TextVerticalMid _toggleRotation = False _toggleBold = False _toggleItalic = False Update() End Sub


    '**** FONCTION RUN *******************
    Public Function Run() As PromptStatus
        Dim stat As PromptStatus = PromptStatus.Keyword
        'While (stat = PromptStatus.Keyword)
        Do While (stat = PromptStatus.Keyword)
            Dim promptResult As PromptResult = _
stat = promptResult.Status Loop 'Raz eventHandler System.Windows.Forms.Application.RemoveMessageFilter(_filter) _filter = Nothing Return stat End Function


ADN Support Specialist
352 Posts
27 Kudos
Registered: ‎07-24-2007
Post 2 of 3

Re: Catching a Righ Click but Autocad got nuts

09-10-2012 04:27 PM in reply to: AubelecBE

It might be easier to create a new Editor.PointMonitor


Editor ed =


    ed.PointMonitor +=



and watch for the right click via the History property...?

Fenton Webb

Developer Technical Services

Autodesk Developer Network

Valued Mentor
411 Posts
29 Kudos
Registered: ‎01-27-2010
Post 3 of 3

Re: Catching a Righ Click but Autocad got nuts

09-11-2012 03:19 AM in reply to: fenton.webb

thank. I dont know how to use event handler.

I must learn this..


i changed the mouse click with key - and + and using this :





Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!