473,239 Members | 1,723 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,239 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 1619

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Benoit Martin | last post by:
Is it possible to detect a mouse click from a .net service. I want a process running in the background that will detect when the user clicks the mouse button (anywhere on the screen) and executes...
by: Brent | last post by:
Hi Is there a way to detect a mouse click anywhere on the screen (not just on your form or a control on the form)? Thanks Brent
by: Charles Law | last post by:
Sorry for reposting this question, but I did not get a single answer last time, and I'm sure you guys must have some thoughts on the matter. I have a user control which can be dragged and dropped...
by: Don | last post by:
Is there a way to capture click events in the form designer? I'm trying to create a control similar to the TabControl (which seems to handle clicks in design mode) and would like to be able to...
by: dfaber | last post by:
Hi all, I have been searching for a keyboard and mouse tracker on linux. I've read solutions (watch at sourceforge) which look at /proc/interrupts to check keyboard or mouse activity. I also read...
by: eliss.carmine | last post by:
Is it possible to simulate a mouse click in the window I made (it's a Form), but not give it focus? I tried using WinAPI's mouseevent and SendMessage of WM_LBUTTONDOWN/WM_LBUTTONUP as suggested...
by: Sin Jeong-hun | last post by:
The term 'system-wide' just means that click is dealt in whole-screen wide level. Just like the real mouse pointer. What I'd like to do is to emulate mouse move and click. For example, the...
by: schneider | last post by:
I need to hook the system mouse down event. I'm trying to replicate how a context menu hides when the mouse clicks outside of the control. Thanks, Schneider
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.