HOWTO: Suppress a TextBox Control's Popup Menu
http://support.microsoft.com/support/kb/articles/Q224/3/02.aspHOWTO: Suppress Default Pop-up Menu When Using Custom Menu
http://support.microsoft.com/support/kb/articles/Q191/6/70.asp
http://support.microsoft.com/support/kb/articles/Q224/3/02.aspHOWTO: Suppress Default Pop-up Menu When Using Custom Menu
http://support.microsoft.com/support/kb/articles/Q191/6/70.asp
http://support.microsoft.com/support/kb/articles/Q224/3/02.aspHOWTO: Suppress Default Pop-up Menu When Using Custom Menu
http://support.microsoft.com/support/kb/articles/Q191/6/70.asp 这里说得清清楚楚,你为什么不看,含代码,步骤!
Public Const GWL_WNDPROC = (-4)
Public Const WM_RBUTTONDOWN = &H204Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPublic prevWndProc As LongFunction WndProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_RBUTTONDOWN Then
Else
WndProc = CallWindowProc(prevWndProc, hWnd, Msg, wParam, lParam)
End If
End Function窗体:
Private Sub Command1_Click()
prevWndProc = GetWindowLong(Text1.hWnd, GWL_WNDPROC)
SetWindowLong Text1.hWnd, GWL_WNDPROC, AddressOf WndProc
Command1.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
If prevWndProc <> 0 Then
SetWindowLong Text1.hWnd, GWL_WNDPROC, prevWndProc
prevWndProc = 0
End If
End Sub