dbTalk Databases Forums  

Setting Language for non-Unicode programs programmatically

comp.databases.ms-access comp.databases.ms-access


Discuss Setting Language for non-Unicode programs programmatically in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
john@kosmosbusiness.com
 
Posts: n/a

Default Setting Language for non-Unicode programs programmatically - 04-01-2009 , 07:39 AM






I am trying to programmatically (vba) set set the "Language for non-
Unicode programs", which can be found in
Control Panel> Regional and Language Options > Advanced (tab)
to a specific language.

Any ideas?

John

Reply With Quote
  #2  
Old   
banem2@gmail.com
 
Posts: n/a

Default Re: Setting Language for non-Unicode programs programmatically - 04-01-2009 , 02:00 PM






On Apr 1, 2:39*pm, j... (AT) kosmosbusiness (DOT) com wrote:
Quote:
I am trying to programmatically (vba) set set the "Language for non-
Unicode programs", which can be found in
Control Panel> Regional and Language Options > Advanced (tab)
to a specific language.

Any ideas?

John
Hi John,

This is the code which will give you an idea. It is not mine, I have
it from somewhere (sorry, I don't know the source...). There a 2
buttons involved Command1 and Command2 to change keyboards:


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

Regards,
Branislav Mihaljev
Microsoft Access MVP


Reply With Quote
  #3  
Old   
banem2@gmail.com
 
Posts: n/a

Default Re: Setting Language for non-Unicode programs programmatically - 04-01-2009 , 02:04 PM



On Apr 1, 2:39*pm, j... (AT) kosmosbusiness (DOT) com wrote:
Quote:
I am trying to programmatically (vba) set set the "Language for non-
Unicode programs", which can be found in
Control Panel> Regional and Language Options > Advanced (tab)
to a specific language.

Any ideas?

John
Hi John,

As far as I know, when you change language for non-Unicode programs,
restart of Windows is required. Probably it can be coded to change it
using VBA, but Windows must restart on each change, so I am not sure
if that is what you want?

Regards,
Branislav Mihaljev
Microsoft Access MVP


Reply With Quote
  #4  
Old   
john@kosmosbusiness.com
 
Posts: n/a

Default Re: Setting Language for non-Unicode programs programmatically - 04-02-2009 , 09:15 AM



You are right that you need a restart. In the worst case I need to let
the user know that the setting is not say Greek, because some text
message (sent in the form of n SMS) will not appear as they should
appear.
Do you know how to check for this setting?
Thanks,
John


Reply With Quote
  #5  
Old   
banem2@gmail.com
 
Posts: n/a

Default Re: Setting Language for non-Unicode programs programmatically - 04-02-2009 , 12:14 PM



On Apr 2, 4:15*pm, j... (AT) kosmosbusiness (DOT) com wrote:
Quote:
You are right that you need a restart. In the worst case I need to let
the user know that the setting is not say Greek, because some text
message (sent in the form of n SMS) will not appear as they should
appear.
Do you know how to check for this setting?
Thanks,
John
Hi John,

Unfortunately no, but have a look here http://www.pcreview.co.uk/forums/thread-526879.php
if that helps.

Regards,
Branislav Mihaljev
Microsoft Access MVP


Reply With Quote
  #6  
Old   
john@kosmosbusiness.com
 
Posts: n/a

Default Re: Setting Language for non-Unicode programs programmatically - 04-02-2009 , 01:56 PM



Hi Branislav,

I think this may help. I have routines which read the registry so in
the worst case I can read the language.

Many thanks,
John


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.