Click to See Complete Forum and Search --> : Language Change!
charisgf
Jul 13th, 2000, 12:14 AM
Does anybody outthere knows how can i change the language with vb or Api code as i change it with ALT-TAB?
Dim
Jul 16th, 2000, 02:48 AM
use SendKeys and send Alt+Tab in combination.
SendKeys "%{F4}"
I forgot the key for name for Tab. :)
gl,
D!m
[Edited by Dim on 07-17-2000 at 12:02 AM]
charisgf
Jul 18th, 2000, 11:49 PM
And if is not Alt-Tab?In many computers it may change with Shift+Alt.That's way i want to change it throuth Api in order to change the language whatever the combination is...
Now, Can u halp me?
/\/\isanThr0p
Jul 19th, 2000, 03:26 AM
It's a very interesting thing.
I need it too.
zdocteur
Jul 27th, 2000, 12:11 PM
i thing i got the answer to that
sendkeys does NOT change the keyboard layout
-------->
try the following:
create a new project
add 2 command keys, 1 listbox and 1 textbox
put the following code in the code section
'<----form1--->
'Form1 add Listbox "list1" , Textbox "text1"
'Command1 "Command1.Caption =English "
'Command2 "Command2.Caption =arabic "
Private Sub Form_Load()
kbdList = GetKeyboardLayoutList(0, 0)
List1.Clear
List1.AddItem "Number of Keyboard installed: " & kbdList
For x = 1 To kbdList
ActiveKbd = ActivateKeyboardLayout(HKL_NEXT, 0)
If Right(Hex(ActiveKbd), 1) = 1 Then
ArabicKbd = ActiveKbd
ElseIf Right(Hex(ActiveKbd), 1) = 9 Then
EnglishKbd = ActiveKbd
End If
Next x
End Sub
Private Sub Command1_Click()
ActiveKbd = ActivateKeyboardLayout(EnglishKbd, 0)
List1.AddItem "Active Keyboard is: " & EnglishKbd
Text1.SetFocus
Text1.Alignment = 0
Text1.RightToLeft = False
End Sub
Private Sub Command2_Click()
ActiveKbd = ActivateKeyboardLayout(ArabicKbd, 0)
List1.AddItem "Active Keyboard is: " & ArabicKbd
Text1.Alignment = 1
Text1.RightToLeft = True
Text1.SetFocus
End Sub
-----------
then add a module
put the following code in it
'<------ module1.bas----->
'Add This code in a Moduel.bas file
Declare Function GetKeyboardLayoutList Lib "user32.dll" (ByVal nBuff As Integer, ByVal lpList As Long) As Long
Declare Function GetKeyboardLayout Lib "user32.dll" (ByVal dwLayout As Long) As Long
Declare Function ActivateKeyboardLayout Lib "user32.dll" (ByVal HKL As Long, Flag As Boolean) As Long
Declare Function LoadKeyboardLayout Lib "user32.dll" Alias "LoadKeyboardLayoutA" (ByVal pwszKLID As Long, Flag As Boolean) As Long
Declare Function GetKeyboardLayoutName Lib "user32.dll" Alias "GetKeyboardLayoutNameA" (ByVal pwszKLID As Long) As Long
Global kbdList As Long
Global ArabicKbd As Long
Global EnglishKbd As Long
Global kbdLayout As Long
----------------------------------------------
----------------------------------------------
this code worked excellent with me
try it and let me know if it worked
;) zdocteur
Nitro
Jul 27th, 2000, 07:36 PM
Zdocteur!
This code work great. I was looking for something like this last week to help Tiovital.
You only missing one constant which you did not declare in your example. It was HKL_NEXT.
I hope you don't mind, but I fixed your code up and so you only need to drop it into a form.
The following is Zdocteur's Code. Drop two command buttons, a textbox and a listbox on to a form.
Option Explicit
'Before running this example - you must have two language.
'Go into [Control Panel-Regional Setting]
'and add another language on the last tab
Private Declare Function GetKeyboardLayoutList Lib "user32.dll" (ByVal nBuff As Integer, ByVal lpList As Long) As Long
Private Declare Function GetKeyboardLayout Lib "user32.dll" (ByVal dwLayout As Long) As Long
Private Declare Function ActivateKeyboardLayout Lib "user32.dll" (ByVal HKL As Long, Flag As Boolean) As Long
Private Declare Function LoadKeyboardLayout Lib "user32.dll" Alias "LoadKeyboardLayoutA" (ByVal pwszKLID As Long, Flag As Boolean) As Long
Private Declare Function GetKeyboardLayoutName Lib "user32.dll" Alias "GetKeyboardLayoutNameA" (ByVal pwszKLID As Long) As Long
Private lng_KeyboardList As Long
Private lng_NonEnglish As Long
Private lng_EnglishKbd As Long
Private Const HKL_NEXT = 1
Private Sub Form_Load()
lng_KeyboardList = GetKeyboardLayoutList(0, 0)
List1.Clear
List1.AddItem "Number of Keyboard installed: " & lng_KeyboardList
Dim int_X As Integer
Dim lng_ActiveKeyBoard As Long
For int_X = 1 To lng_KeyboardList
lng_ActiveKeyBoard = ActivateKeyboardLayout(HKL_NEXT, 0)
If Right(Hex(lng_ActiveKeyBoard), 1) = 1 Then
lng_NonEnglish = lng_ActiveKeyBoard
ElseIf Right(Hex(lng_ActiveKeyBoard), 1) = 9 Then
lng_EnglishKbd = lng_ActiveKeyBoard
End If
Next
End Sub
Private Sub Command1_Click()
Call ActivateKeyboardLayout(lng_EnglishKbd, 0)
List1.AddItem "Active Keyboard is: " & lng_EnglishKbd
Text1.Alignment = 0
Text1.RightToLeft = False
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Call ActivateKeyboardLayout(lng_NonEnglish, 0)
List1.AddItem "Active Keyboard is: " & lng_NonEnglish
Text1.Alignment = 1
Text1.RightToLeft = True
Text1.SetFocus
End Sub
[Edited by Nitro on 07-27-2000 at 08:45 PM]
zdocteur
Jul 27th, 2000, 08:55 PM
its okie Nitro
i have one Q though(non VB-related)
how to post code in in this forum in a way similar to the way you did, i.e. VB- style with colors and different allignments?
;) zdocteur
QWERTY
Jul 27th, 2000, 11:00 PM
use brackets [ ]
example (you need to remove the _):
This is a code
Results with:
This is a code
For a complete list of all VB-code functions go to this link:
http://forums.vb-world.net/index.php?action=bbcode
zdocteur
Jul 29th, 2000, 05:42 PM
do
code.write
if this is correct then
me.gotIt
you.thanx
exit do
else
you(also).thanx
goto sleep
think about it in the morning
end if
loop
exit.browser
;) zdocteur
Tiovital
Jul 29th, 2000, 11:38 PM
zdocteur,
Just for my info - whare did u find that sample?
Regards
zdocteur
Jul 30th, 2000, 10:21 PM
Tiovital,
it's posted here:
http://www.vb4arab.com/ubb/Forum5/HTML/000020.html
the site is:
http://www.vb4arab.com
it's an arabic-oriented VB site - a good resource for arabic programmers.
regards
;) zdocteur
Tiovital
Jul 30th, 2000, 11:30 PM
Thanks
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.