Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabling right mouse click

Status
Not open for further replies.

RizMan

Programmer
Jun 13, 2003
20
FR
I have following situation:
On my form, I have an activeX control (pdf.ocx). I have Acrobat Reader 6 installed. What I need to do is disable the right mouse click in the activeX. This is needed because I don't want users to be able to use the "Print" option in the context-menu. I can deactivate the toolbar, and deactivate the Print HotKey (using RegisterHotKeys Win32 API function call)
However, I can't figure out how to disable the right mouse button click. I tried overriding the WndProc and catching the WM_MOUSEACTIVE and WM_RBUTTONDOWN Messages, but without success.

I hope someone can help me with this
 
Hi i have same thing for texbox and it works fine and hope will work with ActiveX control ..check it,you just have to pass the handle of your control
Regards
Nouman
Private Sub Form_Load()
' Set the control's new WindowProc.
OldWindowProc = SetWindowLong( _
txtMenuDisabled.hWnd, GWL_WNDPROC, _
AddressOf NoPopupWindowProc)
End Sub

' Restore the original WindowProc.
Private Sub Form_Unload(Cancel As Integer)
SetWindowLong _
txtMenuDisabled.hWnd, GWL_WNDPROC, _
OldWindowProc
End Sub
' Pass along all messages except the one that
' makes the context menu appear.
Public Function NoPopupWindowProc(ByVal hWnd As Long, ByVal _
msg As Long, ByVal wParam As Long, ByVal lParam As _
Long) As Long
Const WM_CONTEXTMENU = &H7B

If msg <> WM_CONTEXTMENU Then _
NoPopupWindowProc = CallWindowProc( _
OldWindowProc, hWnd, msg, wParam, _
lParam)
End Function

Nouman Zaheer
Software Engineer
MSR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top