471,321 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

Catch mouse clicks system wide with API call

I' m trying to disable all right mouse clicks by using the
vbAccelerator Windows Hooks Library
The small (systray / console) app. must catch all (right) mouseclicks
before they are received by the users application (for instance IE).
I' m not getting passed the stage where I write to the console catching
clicks on my applications form..

I really doubt if this one's possible at all (especially for an API
noob like me)..

Thanks in advance,

Public Class frmCatchClick
Inherits System.Windows.Forms.Form
Implements vbalWinHook6.IWindowsHook
#Region " Windows Form Designer generated code "

Public Sub New()

'This call is required by the Windows Form Designer.

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
If disposing Then
If Not (components Is Nothing) Then
End If
End If
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents btnOK As System.Windows.Forms.Button
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
<System.Diagnostics.DebuggerStepThrough()> Private Sub
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmcatchc lick))
Me.btnOK = New System.Windows.Forms.Button
Me.StatusBar1 = New System.Windows.Forms.StatusBar
Me.btnOK.BackColor = System.Drawing.SystemColors.Control
Me.btnOK.Location = New System.Drawing.Point(96, 16)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(80, 24)
Me.btnOK.TabIndex = 0
Me.btnOK.Text = "Start Mouse"
Me.StatusBar1.Location = New System.Drawing.Point(0, 59)
Me.StatusBar1.Name = "StatusBar1"
Me.StatusBar1.Size = New System.Drawing.Size(294, 16)
Me.StatusBar1.TabIndex = 1
Me.StatusBar1.Text = "StatusBar1"
'frmcatchclick '
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.LightSteelBlue
Me.ClientSize = New System.Drawing.Size(294, 75)
Me.FormBorderStyle =
Me.Icon = CType(resources.GetObject("$this.Icon"),
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmcatchclickMouse"
Me.Text = "frmcatchclickMouse"
Me.TopMost = True

End Sub

#End Region
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOK.Click
Me.DialogResult = DialogResult.OK
End Sub
Private Function IWindowsHook_HookProc(ByVal eType As
vbalWinHook6.EHTHookTypeConstants, ByVal nCode As Integer, ByVal wParam
As Integer, ByVal lParam As Integer, ByRef bConsume As Boolean) As
Integer Implements vbalWinHook6.IWindowsHook.HookProc
Dim ctlOver As System.Windows.Forms.Control
Dim bS As Boolean
Dim lC As Integer
Dim lhWNd As Integer
Dim bSkip As Boolean

With MyHook.MouselParam(lParam)
Select Case wParam
Case vbalWinHook6.EHTMousewParamValues.WM_MOUSEMOVE
StatusBar1.Text = "MOUSEMOVE"
Case vbalWinHook6.EHTMousewParamValues.WM_RBUTTONDOWN
', vbalWinHook6.EHTMousewParamValues.WM_LBUTTONDOWN
StatusBar1.Text = "MOUSE DOWN!!!"
Case vbalWinHook6.EHTMousewParamValues.WM_NCMOUSEMOVE
Case vbalWinHook6.EHTMousewParamValues.WM_NCRBUTTONDOWN
Case vbalWinHook6.EHTMousewParamValues.WM_RBUTTONUP
StatusBar1.Text = " RIGHT UP"
Case vbalWinHook6.EHTMousewParamValues.WM_NCRBUTTONUP
StatusBar1.Text = "NOCLIENT RIGHT UP!"
End Select

End With
End Function
Private Sub frmcatchclick_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class

May 26 '06 #1
0 1481

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Benoit Martin | last post: by
1 post views Thread by Brent | last post: by
16 posts views Thread by dfaber | last post: by
18 posts views Thread by eliss.carmine | last post: by
reply views Thread by Sin Jeong-hun | last post: by
22 posts views Thread by schneider | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.