Trucos Varios I
DESHABILITAR OPCION DE MENU BOTON DERECHO
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Private Sub mnuOne_Click()
Text1.Text = "Se seleccionó el Menú Uno"
End Sub
Private Sub mnuTwo_Click()
Text1.Text = "Se seleccionó el Menú Dos"
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer,X As Single, Y As Single)
If Button = vbRightButton Then
' Evitar el texto gris bloqueando las actualizaciones
LockWindowUpdate Text1.hWnd
' Un textos "disabled" no saca menú contextual
Text1.Enabled = False
' Dar tiempo a la línea anterior a ejecutarse
DoEvents
' Sacar nuestro propio menú contextual
PopupMenu mnuPopup
' Poner Enable el control de nuevo
Text1.Enabled = True
' Desbloquear las actualizaciones
LockWindowUpdate 0&
End If
End Sub
|