BlackRose
Nov 26th, 1999, 06:17 PM
Hi EveryBody
I Need To Disable right mouse under windows
by using API?
I Need A Exp. SCode
------------------
BlackRose
jedjed
Nov 28th, 1999, 10:59 PM
Try this,
just remember here I'm getting the handle for a common dialog not an app. then I subclass the message handler and filter the messages.
just get the handle of your app with FindWindow and it will work, you'll need its class name.
'''''''''
Private Const WM_CONTEXTMENU = &H7B ' Right click message.
' Handle for the common dialog.
Public lngDialogHWnd As Long
' Handle of the common dialogs class old message handler.
Private lngPrevWndProcDialog As Long
Private Const GWL_WNDPROC = -4 ' Parameter for taking or giving control of the
' message handler for a control.
' Finds the handle of a window.
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
' Send a message on to the apps message handler.
Private 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
' Gives control of the window's message handler to the program.
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
' Once or while your app is loading use this code.
' Finds the dialogs window handle - #32770 is the class name.
' Handle for the dialog, lngDialogHWnd is global.
lngDialogHWnd = FindWindow("#32770", 0&)
Public Sub HookDialog()
' 22/11/99
' Overrides the common dialogs message handler.
lngPrevWndProcDialog = SetWindowLong(lngDialogHWnd, GWL_WNDPROC, AddressOf _
WindowProcDialog)
End Sub
Private Sub UnHookDialog()
' 22/11/99
' Returns control of the message handler.
Dim lngReturnValue As Long
lngReturnValue = SetWindowLong(lngDialogHWnd, GWL_WNDPROC, lngPrevWndProcDialog
End Sub
Function WindowProcDialog(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
' 22/11/99
' Message handler.
' This overrides the dialog box's message handler.
' Message handler for the dialog box.
Select Case uMsg
Case WM_CONTEXTMENU
' Rightclick detected.
WindowProcDialog = True
Case Else
' Pass on all other messages.
WindowProcDialog = CallWindowProc(lngPrevWndProcDialog, hw, uMsg, wParam, lParam)
End Select
End Function
hope it works for ya
map
BlackRose
Nov 29th, 1999, 03:50 AM
Thankx
------------------
BlackRose