Помогите пожалуйста. Мне надо, чтобы в TextBox при нажатии правой кнопки мыши не отображалось никаких меню и вообще ничего. Я все облазил, нигде нет ничего похожего.
Заранее спасибо.
Option Explicit
'=============== Api
Public Declare 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
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'=============== Const
Const GWL_WNDPROC = -4
Public Const WM_RBUTTONUP = &H205
'=============== Var
Public prevWnd As Long
Dim tphWnd As Long
Public Sub Hook(hWnd As Long)
tphWnd = hWnd
prevWnd = SetWindowLong(tphWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Sub UnHook()
Dim lngVal As Long
lngVal = SetWindowLong(tphWnd, GWL_WNDPROC, prevWnd)
End Sub
Private Function WindowProc(ByVal hW As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case Msg
Case WM_RBUTTONUP
' Здесь мона показать своё меню
Case Else
WindowProc = CallWindowProc(prevWnd, hW, Msg, wParam, lParam)
End Select
End Function
Option Explicit
Private Sub Form_Load()
Call Hook(Text1.hWnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call UnHook
End Sub
Сейчас этот форум просматривают: AhrefsBot, Google-бот, Yandex-бот и гости: 65