MartyConnelly
martyconnelly at shaw.ca
Thu Dec 2 01:12:10 CST 2004
Here is another approach, this assumes you are running with a floating
multi language keyboard bar set from the control panel
This works well if using multiple language keyboards, maynot work well
with 97 can't remember.
Switch on textbox's On Focus
Public Declare Function LoadKeyboardLayout Lib "user32" Alias _
"LoadKeyboardLayoutA" (ByVal pwszKLID As String, ByVal Flags As Long) As
Long
Private Declare Function ActivateKeyboardLayout Lib "user32" (ByVal HKL
As Long, _
ByVal Flags As Long) As Long
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias _
"GetKeyboardLayoutNameA" (ByVal pwszKLID As String) As Long
Const KL_NAMELENGTH = 9
Sub testarabic()
Dim lRet As Long
lRet = LoadKeyboardLayout("00000409", 1) ' For English
Debug.Print lRet
lRet = ActivateKeyboardLayout("00000409", 0)
Debug.Print lRet
lRet = LoadKeyboardLayout("00000401", 1) ' For Arabic
Debug.Print lRet
lRet = ActivateKeyboardLayout("00000401", 0)
Debug.Print lRet
lRet = LoadKeyboardLayout("00011009", 1) ' For FrenchCanadian
Debug.Print lRet
lRet = ActivateKeyboardLayout("00011009", 0)
Debug.Print lRet
End Sub
Sub resetenglish()
Dim lRet As Long
lRet = LoadKeyboardLayout("00000409", 1) ' For US English
Debug.Print lRet
lRet = ActivateKeyboardLayout("00000409", 0)
Debug.Print lRet
End Sub
Sub whatiskeybd()
Dim kbname(100) As Byte
Dim strkbname As String
GetKeyboardLayoutName (kbname) ' //place keyboard layout name in r
strkbname = kbname
Debug.Print strkbname
Dim I As Long
For I = 0 To 20
Debug.Print kbname(I)
Next I
'Loadkeyboardlayout('00000409', KLF_ACTIVATE);//Activate US keyboard layout
'//Do your stuff here
'Loadkeyboardlayout(r, KLF_ACTIVATE);//
Dim strName As String
'Create a buffer
strName = String(KL_NAMELENGTH, 0)
'Get the keyboard layout name
GetKeyboardLayoutName strName
Debug.Print "Keyboard layout name: " + strName
End Sub
handyman at actcom.co.il wrote:
> Hi All,
>
> When I enter data in a certain textbox, I need to do a "Left Alt +
> Shift" in order to change the language from English to another
> language. Is there a way I can send this via code when entering the
> textbox, and then again when exiting the textbox. I would imagine I
> need to do it in the On Enter event, but how do I send the "Left Alt +
> Shift"?
>
> Thanks
>
> Gershon Markowitz
> mailto:Handyman at actcom.co.il
>
--
Marty Connelly
Victoria, B.C.
Canada