VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



To Suppress Default Pop-up Menu When Using Custom Menu

by Ashita Nair (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Mon 17th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



'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
 

Download this snippet    Add to My Saved Code

To Suppress Default Pop-up Menu When Using Custom Menu Comments

No comments have been posted about To Suppress Default Pop-up Menu When Using Custom Menu. Why not be the first to post a comment about To Suppress Default Pop-up Menu When Using Custom Menu.

Post your comment

Subject:
Message:
0/1000 characters