zjcly6 发表于 2011-3-6 02:15:31

模拟键盘判断键值是否长按

大家好。是不是_ISPRESSED 函数用错了么?只能开启长按ALT键再次按的时候关闭不了..
另外程序结束后好像ALT键还是一直被长按的,请问这怎么解决?
谢谢了
#include <GUIConstants.au3>
#include <Misc.au3>

$dll = DllOpen("user32.dll")

GUICreate("魔兽显血",200,100)
GUICtrlCreateLabel("Home Button",10,40,50)
GUISetState(@SW_SHOW)
HotKeySet("{Home}","Open_Fun")

Func Open_Fun()
        If _IsPressed("12,$dll") Then
                Send("{ALT up}")
                MsgBox(0,"Button is released!","Button is released!")
        Else
                Send("{ALT down}")
                MsgBox(0,"Button is pressed!","Button is pressed!")
                EndIf
        EndFunc

While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
                WEnd

netegg 发表于 2011-3-6 02:48:09

dllclose呢,帮助里不是写的很明白吗

www378660084 发表于 2011-3-7 22:41:03

你打魔兽,一直按着alt,如果点左键的话,好像别人会很不爽的..

zjcly6 发表于 2011-3-10 17:21:00

谢谢2楼的朋友.
页: [1]
查看完整版本: 模拟键盘判断键值是否长按