|
-
Jul 11th, 2000, 08:40 AM
#1
Thread Starter
Hyperactive Member
I have a text box on the form, when someone "Right clicks" A paste option comes up if they have something in their clipboard....how can i go about disabling this?
-RaY
VB .Net 2010 (Ultimate)
-
Jul 11th, 2000, 09:03 AM
#2
Thread Starter
Hyperactive Member
Any suggestions?
I was thinking about disabling the right click, instead of worrying about actually clearing out the clipboard....maybe this would be a easier approach.
-RaY
VB .Net 2010 (Ultimate)
-
Jul 11th, 2000, 09:18 AM
#3
_______
<?>
Code:
'get rid of popup for text box on right click
'
'<<<<<<<<<< put this in a bas module >>>>>>>>>>>>>>>>>>
'
Option Explicit
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
Public Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Const GWL_WNDPROC = -4
Public Const WM_RBUTTONUP = &H205
Public lpPrevWndProc As Long
Public lngHWnd As Long
Public Sub Hook(hWnd As Long)
lngHWnd = hWnd
lpPrevWndProc = SetWindowLong(lngHWnd, GWL_WNDPROC, _
AddressOf WindowProc)
End Sub
Public Sub UnHook()
Dim lngReturnValue As Long
lngReturnValue = SetWindowLong(lngHWnd, GWL_WNDPROC, _
lpPrevWndProc)
End Sub
Public Function WindowProc(ByVal hw As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case WM_RBUTTONUP
'Do nothing
'Or popup your own menu
Case Else
WindowProc = CallWindowProc(lpPrevWndProc, hw, _
uMsg, wParam, lParam)
End Select
End Function
' <<<<<<<<<<<<<<<< form code >>>>>>>>>>>>>>>>>>>>>
'Add the following code to the Form_Load event of the form where the text box is placed:
Call Hook(Text1.hWnd)
'Where Text1 is the name of the text box you want to Subclass.
'Add the following code to the Form_Unload event:
Call UnHook
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 11th, 2000, 09:20 AM
#4
Thread Starter
Hyperactive Member
That may work but
Im using VB3.0....so i can't using any functions such as user32, kernerl32....anything with 32...... So has to be another way to disable the right mouse click in just that text box.
-RaY
VB .Net 2010 (Ultimate)
-
Jul 11th, 2000, 10:16 AM
#5
Thread Starter
Hyperactive Member
Everyone..
Out of ideas already guys? Don't give up on me yet!
-RaY
VB .Net 2010 (Ultimate)
-
Jul 11th, 2000, 01:16 PM
#6
This code will work, except HeSaidJoe's way won't pop up a message, it will just be disabled.
Code:
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
MsgBox "Right Context Menu Disabled!", 16
End If
End Sub
-
Jul 13th, 2000, 04:45 PM
#7
that would work, but just like the javascript code for disabling the rightclick menu... well you can rightclick-escape-let go of right button... really fast, and that menu appears magicly!
which sucks 
-
Jul 13th, 2000, 09:52 PM
#8
Lively Member
Another thing that a lot of people seem to forget is the button on the keyboard for right click. Which isnt a mousedown, mouseup or click event :-)
-
Jul 13th, 2000, 11:12 PM
#9
What do you want?!? A rocket scientists answer? Or Megatron's answer? ;]
Code:
If Button = 2 Or Button = 3 Then
Msgbox "What do you think your doing!?!", 16
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|