473,785 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,

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

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

End Sub

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

'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the Windows Form
Designer
'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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Dim resources As System.Resource s.ResourceManag er = New
System.Resource s.ResourceManag er(GetType(frmc atchclick))
Me.btnOK = New System.Windows. Forms.Button
Me.StatusBar1 = New System.Windows. Forms.StatusBar
Me.SuspendLayou t()
'
'btnOK
'
Me.btnOK.BackCo lor = System.Drawing. SystemColors.Co ntrol
Me.btnOK.Locati on = New System.Drawing. Point(96, 16)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing. Size(80, 24)
Me.btnOK.TabInd ex = 0
Me.btnOK.Text = "Start Mouse"
'
'StatusBar1
'
Me.StatusBar1.L ocation = New System.Drawing. Point(0, 59)
Me.StatusBar1.N ame = "StatusBar1 "
Me.StatusBar1.S ize = New System.Drawing. Size(294, 16)
Me.StatusBar1.T abIndex = 1
Me.StatusBar1.T ext = "StatusBar1 "
'
'frmcatchclick '
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.BackColor = System.Drawing. Color.LightStee lBlue
Me.ClientSize = New System.Drawing. Size(294, 75)
Me.Controls.Add (Me.StatusBar1)
Me.Controls.Add (Me.btnOK)
Me.FormBorderSt yle =
System.Windows. Forms.FormBorde rStyle.Fixed3D
Me.Icon = CType(resources .GetObject("$th is.Icon"),
System.Drawing. Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmcatchclickM ouse"
Me.Text = "frmcatchclickM ouse"
Me.TopMost = True
Me.ResumeLayout (False)

End Sub

#End Region
Private Sub btnOK_Click(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles btnOK.Click
Me.DialogResult = DialogResult.OK
End Sub
Private Function IWindowsHook_Ho okProc(ByVal eType As
vbalWinHook6.EH THookTypeConsta nts, ByVal nCode As Integer, ByVal wParam
As Integer, ByVal lParam As Integer, ByRef bConsume As Boolean) As
Integer Implements vbalWinHook6.IW indowsHook.Hook Proc
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.MouselPa ram(lParam)
Select Case wParam
Case vbalWinHook6.EH TMousewParamVal ues.WM_MOUSEMOV E
StatusBar1.Text = "MOUSEMOVE"
Case vbalWinHook6.EH TMousewParamVal ues.WM_RBUTTOND OWN
', vbalWinHook6.EH TMousewParamVal ues.WM_LBUTTOND OWN
StatusBar1.Text = "MOUSE DOWN!!!"
Case vbalWinHook6.EH TMousewParamVal ues.WM_NCMOUSEM OVE
StatusBar1.Text = "NOCLIENTMOUSEM OVE"
Case vbalWinHook6.EH TMousewParamVal ues.WM_NCRBUTTO NDOWN
StatusBar1.Text = "NOCLIENT RIGHT DOWN"
Case vbalWinHook6.EH TMousewParamVal ues.WM_RBUTTONU P
StatusBar1.Text = " RIGHT UP"
Case vbalWinHook6.EH TMousewParamVal ues.WM_NCRBUTTO NUP
StatusBar1.Text = "NOCLIENT RIGHT UP!"
End Select

End With
End Function
Private Sub frmcatchclick_L oad(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
MyHook.InstallH ook(Me,
vbalWinHook6.EH THookTypeConsta nts.WH_MOUSE)
End Sub
End Class

May 26 '06 #1
0 1669

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

Similar topics

2
4930
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 an action accordingly. All the event handlers for the mouse that I see are for Windows Forms. Is there a way to do it without any controls on the screen? Thanks
1
2774
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
5
3723
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 onto a form in my application when it is running. I allow it to be clicked and dragged to a new location on the form. However, the user control has a check box on it, and if the user clicks over the checkbox to drag the user control, the check...
5
4183
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 click on parts of the control in design mode and have the control react, but I can't seem to trap the events in design mode. - Don
16
10942
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 one post where "watch" seems to have difficulty tracking usb keyboards and mice. So, I'm out of ideas here. My goal are: 1. Check keyboard activity. I'm not interested in logging which keys are pressed or record them.
18
22117
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 the folks in #winapi on EFnet, but I think those require the window to have focus. Either that, or I'm doing something else wrong. The click actually seems to work once, and then stops working... I have no idea what is the problem actually....
0
2014
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 command is something like "Move the mouse to the 300,400 of the screen and click." I know that I can send mouse clcik message to a specific window using WinAPI. But can't I just emulate 300,400 click of the real screen? I thought that I might need to...
22
6437
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
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9958
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8986
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.