Click to See Complete Forum and Search --> : Lock mouse input


sequel
06-22-2006, 03:26 AM
How can we lock mouse just for our application. I mean ... i dont want to lock mouse for the windows as "BlockInput" API does, i just want to block mouse input on my application for a specified time.

Regards

Phil Weber
06-22-2006, 09:11 AM
Set the Enabled property of the visible form(s) or controls to False.

sequel
06-22-2006, 09:48 AM
by setting Enabled=False, form is grayed out :)

Phil Weber
06-22-2006, 11:58 AM
OK, how about simply ignoring any mouse clicks you receive?

sequel
06-23-2006, 02:40 AM
Yes, this is what i need, but how?? Do i need to capture the mouse events for controls, IMO this is not a good approach. What do you suggest?

Phil Weber
06-23-2006, 04:57 AM
' Declare form-level 'ignore mouse' flag
' Set to True when you want to 'disable' the mouse
Private bIgnoreMouse As Boolean

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
' Check flag in all mouse-related event handlers
If Not bIgnoreMouse Then
' Handle mouse click
End If
End Sub