Jump to content

Disable Mouse but NO keyboard


Recommended Posts

BlockInput () disables or enables both of them.

I want to disable only MOUSE. Anyone knows ?

Tnx. P.

<{POST_SNAPBACK}>

I believe you can set

Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass

Value: Start

Data: 0x00000004 (Hex)

To disable the mouse, but I think it only works after a reboot.

Set it back to 0x00000001 for normal operation, again, you would have to reboot.

Edited by oobnuker
Link to comment
Share on other sites

ClipCursor API

<{POST_SNAPBACK}>

Hm, so this code should do the trick, but it does not work on my system. Return code looks good. Who knows what's wrong?

#include <GUIConstants.au3>

msgbox(0,"START","Will block mouse now")
block_mouse()
sleep(5000)
unblock_mouse()
msgbox(0,"STOP","Mouse is unblocked now")


func unblock_mouse()
     $rect = DllStructCreate("uint;uint;uint;uint")
     DllStructSetData($rect,1,0)
     DllStructSetData($rect,2,0)
     DllStructSetData($rect,3,@DesktopWidth)
     DllStructSetData($rect,4,@DesktopHeight)
     $rect_ptr = DllStructGetPtr($rect)
     $retval = DllCall("user32.dll","long","ClipCursor","long_ptr",$rect_ptr)
     msgbox(0,"","Retval: " & $retval[0] & " " & @error)
endfunc

func block_mouse()
     $pos = MouseGetPos()
     $rect = DllStructCreate("uint;uint;uint;uint")
     DllStructSetData($rect,1,$pos[0])
     DllStructSetData($rect,2,$pos[1])
     DllStructSetData($rect,3,$pos[0]+1)
     DllStructSetData($rect,4,$pos[1]+1)
     $rect_ptr = DllStructGetPtr($rect)
     $retval = DllCall("user32.dll","long","ClipCursor","long_ptr",$rect_ptr)
     msgbox(0,"","Retval: " & $retval[0] & " " & @error)
endfunc

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

i made this

Func _MouseTrap($l_left, $l_top, $l_right, $l_bottom)

$v_Rect = DllStructCreate('int;int;int;int')

DllStructSetData($v_Rect, 1, $l_left)
DllStructSetData($v_Rect, 2, $l_top)
DllStructSetData($v_Rect, 3, $l_right)
DllStructSetData($v_Rect, 4, $l_bottom)

$ai_Ret = DllCall('user32.dll', 'int', 'ClipCursor', 'ptr', DllStructGetPtr($v_Rect))

ConsoleWrite('Error: ' & @ERROR & @LF)

DllStructDelete($v_Rect)

Return $ai_Ret[0]

EndFunc

it works but just for a mili-second.

WHile 1
    ConsoleWrite('Func:  ' & _MouseTrap(10, 10, 100, 100) & @LF)
WEnd

does work. but as soon as the program terminates. the trap is gone.

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...