supergg02 Posted February 6, 2006 Posted February 6, 2006 (edited) in some api call we got a wparm (wparm is a virtual key according to MS SDK) as a returned resultIs there a way to convert this wparm to char according to keyboard layout ?thinks a lot Edited February 6, 2006 by supergg02
Laine Posted February 6, 2006 Posted February 6, 2006 in some api call we got a wparm (wparm is a virtual key according to MS SDK) as a returned resultMost Win32 api functions involve <b>Wparam</b> and <b> Lparam</b> to send and receive information.There are api functions to map VK_KEYS to keyboard layout.If it has to do with autoIt though you'll have to be more specific so those guys can point you in the right direction.
cdkid Posted February 6, 2006 Posted February 6, 2006 mmm... try this expandcollapse popupFunc _SendKeys($hWnd, $keys) If $hWnd <= 0 Or StringLen($keys) = 0 Then SetError(-1) Return False EndIf $keys = StringUpper($keys) $keys = StringReplace($keys, "`", Chr($VK_OEM_3)) $keys = StringReplace($keys, "~", Chr($VK_OEM_3)) $keys = StringReplace($keys, "-", Chr($VK_OEM_MINUS)) $keys = StringReplace($keys, "=", Chr($VK_OEM_PLUS)) $keys = StringReplace($keys, "{ENTER}", Chr(0xD)) $keys = StringReplace($keys, "{TAB}", Chr(0x9)) $keys = StringReplace($keys, "{ESC}", Chr($VK_ESC)) $keys = StringReplace($keys, "{F5}", Chr($VK_F5)) $keys = StringReplace($keys, "{F12}", Chr($VK_F12)) $keys = StringReplace($keys, "{SHIFT}", "+") Local $i, $ret Local $shiftdown = False For $i = 1 To StringLen($keys) If StringMid($keys, $i, 1) = "+" Then DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x002A0001) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x402A0001) $shiftdown = True Sleep(1) ContinueLoop Else $ret = DllCall("user32.dll", "int", "MapVirtualKey", "int", Asc(StringMid($keys, $i, 1)), "int", 0) If IsArray($ret) Then DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0])) Sleep(1) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]) + 0xC0000000) EndIf EndIf If $shiftdown Then Sleep(1) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x10, "long", 0xC02A0001) $shiftdown = False EndIf Next Return True EndFunc Func _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc ...i didnt write this, im not gonna take credit for. i dont knwo who did ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
supergg02 Posted February 6, 2006 Author Posted February 6, 2006 Here a short description about what I mean: It is a API function that return a Wparam and Lparam : here is a prototype:LRESULT CALLBACK KeyboardProc( int code, WPARAM wParam, LPARAM lParam);wParam [in] Specifies the virtual-key code of the key that generated the keystroke message.lParam [in] Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag. For more information about the lParam parameter, see Keystroke Message Flags. This parameter can be one or more of the following values. 0-15 Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user's holding down the key. 16-23 Specifies the scan code. The value depends on the OEM. 24 Specifies whether the key is an extended key, such as a function key or a key on the numeric keypad. The value is 1 if the key is an extended key; otherwise, it is 0. 25-28 Reserved. 29 Specifies the context code. The value is 1 if the ALT key is down; otherwise, it is 0. 30 Specifies the previous key state. The value is 1 if the key is down before the message is sent; it is 0 if the key is up. 31 Specifies the transition state. The value is 0 if the key is being pressed and 1 if it is being released. So my question is How to convert returned Data (ie Wparam and L param) to a char ?Hope it is clear know and thinks a lot for any help
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