simuler clavier SENDINPUT API avec changement de langue VB.NET sous VS2010 profesionnel /test avec XP
Bonjour,
Pour simuler un clavier quelque soit l'application ayant le focus j'utilise
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function SendInput(ByVal nInputs As UInteger, ByRef pInputs As INPUT, ByVal cbSize As Integer) As UInteger
End Function
'entrée:vkcode =code de la touche 0/255)
Public Sub touche(ByVal vkCode As UInteger)
Dim keyInput As INPUT
keyInput.type = INPUT_KEYBOARD
Dim key As KEYBDINPUT
key.wVk = 0
key.wScan = MapVirtualKeyEx(vkCode, 0, &HE801) 'vkCode
key.dwFlags = 0 ' KEYEVENTF_UNICODE Or 2
keyInput.ki = key
SendInput(1, keyInput, Marshal.SizeOf(GetType(INPUT)))
End Sub |
Note:le code &HE801( language identifier) correspond à la langue Thailandaise installée sur Windows
Si je n'utilise pas le changement de langue key.wScan=vkcode cela fonctionne ,je simule les touches du clavier Français .
Si j'utilise key.wScan =MapvirtualKeyEx(vkCode, 0, &HE801) Sendiput envoie des codes genre raccourcis windows mais je n'obtiens aucun caractère correct
Je ne trouve pas pourquoi !!!
Merci pour votre aide :merci: