To Suppress Default Pop-up Menu When Using Custom Menu
To Suppress Default Pop-up Menu When Using Custom Menu
API Declarations
(ByVal hwndLock As Long) As Long
Rate To Suppress Default Pop-up Menu When Using Custom Menu
(1(1 Vote))
'Choose Menu Editor from the Tools menu and create a menu named mnuPopUp on Form1. Deselect the Visible CheckBox and add items such as the following:
' File
' New
' Open
Private Sub Text1_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 Text1.hWnd
' A disabled TextBox will not display a context menu
Text1.Enabled = False
' Give the previous line time to complete
DoEvents
' Display our own context menu
PopupMenu mnuPopup
' Enable the control again
Text1.Enabled = True
' Unlock updates
LockWindowUpdate 0&
End If
End Sub
To Suppress Default Pop-up Menu When Using Custom Menu Comments
No comments yet — be the first to post one!
Post a Comment