Results 1 to 3 of 3

Thread: How Can I Disable Right Mouse ?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Lebanon, Beirut
    Posts
    63

    Post

    Hi EveryBody
    I Need To Disable right mouse under windows
    by using API?
    I Need A Exp. SCode

    ------------------
    BlackRose

  2. #2
    New Member
    Join Date
    Nov 1999
    Posts
    12

    Post

    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

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Lebanon, Beirut
    Posts
    63

    Post

    Thankx

    ------------------
    BlackRose

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width