Results 1 to 2 of 2

Thread: ?How to prevent a right-click from displaying a popup menu

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2001
    Location
    CO
    Posts
    1

    Question ?How to prevent a right-click from displaying a popup menu

    Using TrueDB Grid and when right clicking in current cell the edit popup menu comes up. I don't want this to happen. I'm going to display my own frame.

    Help??

    Thanks LW

  2. #2
    Matthew Gates
    Guest
    I've never worked with the TrueDB Grid control, but I believe you can subclass it by intercepting the WM_NCRBUTTONDOWN message.


    VB Code:
    1. Public Declare Function SetWindowLong& Lib "user32" _
    2. Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As _
    3. Long, ByVal dwNewLong As Long)
    4.  
    5. Public Declare Function CallWindowProc Lib "user32" _
    6. Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal _
    7. hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal _
    8. lParam As Long) As Long
    9.  
    10. Const GWL_WNDPROC = (-4)
    11. Const WM_NCRBUTTONDOWN = &HA4
    12. Public WndProcOld As Long
    13.  
    14. Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    15.        
    16.     If wMsg = WM_MYMESSAGE Then
    17.         MsgBox "Message recieved"
    18.         Exit Function
    19.     End If
    20.    
    21.     WindProc = CallWindowProc(WndProcOld&, hwnd&, wMsg&, wParam&, lParam&)
    22.    
    23. End Function
    24.  
    25. Sub SubClassWnd(hwnd As Long)
    26.     WndProcOld& = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindProc)
    27. End Sub
    28.  
    29. Sub UnSubclassWnd(hwnd As Long)
    30.     SetWindowLong hwnd, GWL_WNDPROC, WndProcOld&
    31.     WndProcOld& = 0
    32. End Sub
    33.  
    34.  
    35. '[b][u]Usage[/u][/b]
    36.  
    37.  
    38. Private Sub Form_Load()
    39.     SubClassWnd hwnd
    40. End Sub
    41.  
    42. Private Sub Form_Unload(Cancel As Integer)
    43.     UnSubclassWnd hwnd
    44. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width