w0uter Posted July 4, 2006 Share Posted July 4, 2006 Just a small rewrite to make it faster and use a bit less memory. Note it is not compatible with the old one but can easely be modified to. just ad a '0x' & like the old one has. But its verry silly to have a func that FORCES you to input in hex if the dllcall accepts decimal too. Anyways have fun. $val = 100000 $t = TimerInit() For $i = 0 To $val _IsPressed(1) Next ConsoleWrite(TimerDiff($t) & @LF) $t = TimerInit() For $i = 0 To $val __sPressed(1) Next ConsoleWrite(TimerDiff($t) & @LF) Func _IsPressed($v_R, $v_dll = 'user32.dll') $v_R = DllCall($v_dll, 'int', 'GetAsyncKeyState', 'int', $v_R) Return (Not @error And BitAND($v_R[0], 0x8000) = 0x8000) * 1 EndFunc ;==>_IsPressed Func __sPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc ;==>__sPressed 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 More sharing options...
erifash Posted July 4, 2006 Share Posted July 4, 2006 (edited) What about this?Func _IsPressed( $key ) Local $aR = DllCall('user32.dll', 'int', 'GetAsyncKeyState', 'int', $key) Return $aR[0] = -32767 EndFunc EDIT:make it faster and use a bit less memoryokay, nevermind. Edited July 4, 2006 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now