I have found all alone (finally i hope ) how simulate a key press for the API ToUnicode_() and ToAscii_()
That works for the SHIFT key but not for the "ALT GR" (Right ALT)
After searching a long time i have found, that if i give this two value 128 / 129 in decimal that works
Code: Select all
; WORKS VERY WELL
Key(#VK_CONTROL) = 128 ; Virtual VK_CONTROL pressed
Key(#VK_MENU) = 129 ; Virtual VK_MENU pressed
Code: Select all
; NOT WORKS
Key(#VK_CONTROL) & %10000000 ; Virtual VK_CONTROL pressed
Key(#VK_MENU) & %10000000 ; Virtual VK_MENU pressed
If someone have understand why
Code: Select all
Global Dim Key.a(256)
Procedure GetInfos(Character$)
Ascii_ByAsc = Asc(Character$)
VkCode = VkKeyScan_(Ascii_ByAsc) & $FF
ToAscii_(VkCode, MapVirtualKey_(VkCode, 0), @Key(), @Ascii_ByToAscii.w, 0)
ToUnicode_(VkCode, MapVirtualKey_(VkCode, 0), @Key(), @Ascii_ByToUnicode, SizeOf(Ascii_ByToUnicode) / SizeOf(character) - 1,0)
Debug "Character$ = " + Character$
Debug "Ascii_ByAsc = " + Ascii_ByAsc
Debug "Chr(Ascii_ByAsc) = " + Chr(Ascii_ByAsc)
Debug "Ascii_ByToAscii = " + Ascii_ByToAscii
Debug "Chr(Ascii_ByToAscii) = " + Chr(Ascii_ByToAscii)
Debug "Ascii_ByToUnicode = " + Ascii_ByToUnicode
Debug "Chr(Ascii_ByToUnicode) = " + Chr(Ascii_ByToUnicode)
Debug #CRLF$ + RSet("", 20, "#") + #CRLF$
EndProcedure
Debug "Try LCASE" + #CRLF$
GetInfos("a")
Debug "Try UCASE" + #CRLF$
Key(#VK_SHIFT) & %10000000 ; Virtual SHIFT pressed
GetInfos("A")
Dim Key.a(256)
Debug "Try ALTGR (Right ALT) WORKS VERY WELL" + #CRLF$
Key(#VK_CONTROL) = 128 ; Virtual VK_CONTROL pressed
Key(#VK_MENU) = 129 ; Virtual VK_MENU pressed
GetInfos("$")
Dim Key.a(256)
Debug "Try ALTGR (Right ALT) NOT WORKS" + #CRLF$
Key(#VK_CONTROL) & %10000000 ; Virtual VK_CONTROL pressed
Key(#VK_MENU) & %10000000 ; Virtual VK_MENU pressed
GetInfos("$")