請問如何禁用滑鼠?[已解決]
本帖最后由 ragnada 于 2010-5-6 16:16 编辑我想在autoit運行中的時侯,可以鎖定滑鼠不給人動到,程式跑完後再啟用 LZ是哪个OEM/ODM MFG的? BlockInput这个不知道行不行 不知道有沒有辦法只鎖滑鼠,不鎖鍵盤:face (29):,因為我有設定按esc可以停止@@ 真的沒有辦法只鎖住滑鼠嗎:face (30): 本帖最后由 lainline 于 2010-5-5 11:08 编辑
可以但是 代码比较复杂
#include <WinAPI.au3>
Global $hM_Hook
_MouseSetOnEvent()
Sleep(2000)
OnAutoItExit()
Func OnAutoItExit();结束鼠标钩子
DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook)
EndFunc
Func _MouseSetOnEvent();鼠标钩子挂钩
$hKey_Proc = DllCallbackRegister("_Mouse_Events_Handler", "int", "int;ptr;ptr")
$hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
$hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, _
"ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module, "dword", 0)
EndFunc
Func _Mouse_Events_Handler($nCode, $wParam, $lParam);鼠标钩子回调函数
Return 1
EndFunc 可以但是 代码比较复杂
#include <WinAPI.au3>
Global $hM_Hook
_MouseSetOnEvent()
Sleep(2000)
OnAutoItExit()
Func OnAutoItExit();结束鼠标钩子
DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook)
EndFunc
Func _MouseSetOnEvent();鼠标钩子挂钩
$hKey_Proc = DllCallbackRegister("_Mouse_Events_Handler", "int", "int;ptr;ptr")
$hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
$hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, _
"ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module, "dword", 0)
EndFunc
Func _Mouse_Events_Handler($nCode, $wParam, $lParam);鼠标钩子回调函数
Return 1
EndFunc
学习了, 可以但是 代码比较复杂
#include
Global $hM_Hook
_MouseSetOnEvent()
Sleep(2000)
OnAutoItExit() ...
lainline 发表于 2010-5-5 11:06 http://www.autoitx.com/images/common/back.gif
感謝了~~~, 來去試試看,順便學習學習,查一查函數說明:face (35): 似乎用BlockInput就Ok了!
BlockInput(1)
写你的程序
BlockInput(0) 似乎用BlockInput就Ok了!
BlockInput(1)
写你的程序
BlockInput(0)
lion.lee 发表于 2010-5-13 23:54 http://www.autoitx.com/images/common/back.gif
BlockImput 會鍵盤及滑鼠都鎖住,如果程式寫失敗了,就只有重開機一途了:face (8):
页:
[1]