mike1950r Posted January 10 Share Posted January 10 Hi, sorry I'm a bit confused. I'm finding two functions with the same name. Has this been replaced or updated ? expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_GetKeyboardState ; Description ...: Returns the status of the 256 virtual keys ; Syntax.........: _WinAPI_GetKeyboardState($iFlag=0) ; Parameters ....: $iFlag - Return Type ; 0 Returns an array[256] ; 1 Returns a string ; Return values .: Success - Array[256] or String containing status of 256 virtual keys ; Failure - False ; Author ........: Eukalyptus ; Modified.......: ; Remarks .......: If the high-order bit is 1, the key is down; otherwise, it is up. ; If the key is a toggle key, for example CAPS LOCK, then the low-order bit is 1 ; when the key is toggled and is 0 if the key is untoggled ; Related .......: _IsPressed ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _WinAPI_GetKeyboardState($iFlag = 0) Local $aDllRet, $lpKeyState = DllStructCreate("byte[256]") $aDllRet = DllCall("User32.dll", "int", "GetKeyboardState", "ptr", DllStructGetPtr($lpKeyState)) If @error Then Return SetError(@error, 0, 0) If $aDllRet[0] = 0 Then Return SetError(1, 0, 0) Else Switch $iFlag Case 0 Local $aReturn[256] For $i = 1 To 256 $aReturn[$i - 1] = DllStructGetData($lpKeyState, 1, $i) Next Return $aReturn Case Else Return DllStructGetData($lpKeyState, 1) EndSwitch EndIf EndFunc ;==>_WinAPI_GetKeyboardState ; #FUNCTION# ==================================================================================================================== ; Author.........: Yashied ; Modified.......: jpm ; =============================================================================================================================== Func _WinAPI_GetKeyboardState() Local $tData = DllStructCreate('byte[256]') Local $aRet = DllCall('user32.dll', 'bool', 'GetKeyboardState', 'struct*', $tData) If @error Or Not $aRet[0] Then Return SetError(@error + 10, @extended, 0) Return $tData EndFunc ;==>_WinAPI_GetKeyboardState Thanks for assistance Cheers mike Link to comment Share on other sites More sharing options...
Danp2 Posted January 10 Share Posted January 10 Did you find them both in the UDFs that ship with AutoIt? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
argumentum Posted January 10 Share Posted January 10 1 hour ago, mike1950r said: I'm finding two functions with the same name. what includes ?. I've checked and only your 2nd func by Yashied is in the distro. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Musashi Posted January 10 Share Posted January 10 36 minutes ago, argumentum said: I've checked and only your 2nd func by Yashied is in the distro. In my official installation , too, I can only find one include file in which the function exists (once). By the way: If one creates an AutoIt script in which two functions have the identical name, an error message appears (... already defined). "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
argumentum Posted January 10 Share Posted January 10 It's likely he's got it from https://www.autoitscript.com/forum/topic/123826-how-to-know-if-any-key-is-pressed/?do=findComment&comment=859911 and has it in another include without noticing. Musashi 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
mike1950r Posted January 10 Author Share Posted January 10 Hi, thanks for the reply. One function I found in following thread: Link to Function When using this function in a script I got the error message 'Dublicate function name', and when looking for that I found the other function in 'WinAPISys.au3' with the same name. This is why I got confused. Cheers mike 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