Suppressing default popup menu on a text box
VB Code:
Private Declare Function LockWindowUpdate Lib "user32" _ (ByVal hwndLock As Long) As Long Private Sub TextBox_MouseDown(Button As Integer, Shift As Integer, _ X As Single, Y As Single) If Button = vbRightButton Then ' Avoid the 'disabled' gray text by locking updates LockWindowUpdate TextBox.hwnd ' A disabled TextBox will not display a context menu TextBox.Enabled = False ' Give the previous line time to complete DoEvents ' Display our own context menu PopupMenu mnuPopup ' Enable the control again TextBox.Enabled = True ' Unlock updates LockWindowUpdate 0& End If End Sub




Reply With Quote