Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How can I switch keyboard language from VB code.

 
   Database Forums (Home) -> Visual Basic -> DAO RSS
Next:  Strange problem with max()?  
Author Message
Yuvigi

External


Since: Mar 14, 2007
Posts: 4



(Msg. 1) Posted: Wed Mar 14, 2007 5:01 am
Post subject: How can I switch keyboard language from VB code.
Archived from groups: microsoft>public>vb>database>dao (more info?)

I am writing an MS Access application. Text in some controls on forms must be
typed in Cyrillic, in others - in English. How can I change keyboard language
from code upon entering certain control?

 >> Stay informed about: How can I switch keyboard language from VB code. 
Back to top
Login to vote
Max Kudrenko

External


Since: Mar 21, 2005
Posts: 5



(Msg. 2) Posted: Mon Mar 26, 2007 4:47 am
Post subject: Re: How can I switch keyboard language from VB code. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Yuvigi,

Check the ActivateKeyboardLayout function. Here's a good example of
its use at the bottom: http://allapi.mentalis.org/apilist/ActivateKeyboardLayout.shtml

Hope this helps,

Max Kudrenko
Brainbench MVP Program for Visual Basic
www.brainbench.com


On Mar 14, 1:01 pm, Yuvigi wrote:
> I am writing an MS Access application. Text in some controls on forms must be
> typed in Cyrillic, in others - in English. How can I change keyboard language
> from code upon entering certain control?

 >> Stay informed about: How can I switch keyboard language from VB code. 
Back to top
Login to vote
Richard T. Edwards

External


Since: Feb 04, 2006
Posts: 14



(Msg. 3) Posted: Wed Mar 28, 2007 6:56 am
Post subject: Re: How can I switch keyboard language from VB code. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You might want to try using WMI.


"Yuvigi" wrote in message

>I am writing an MS Access application. Text in some controls on forms must
>be
> typed in Cyrillic, in others - in English. How can I change keyboard
> language
> from code upon entering certain control?
 >> Stay informed about: How can I switch keyboard language from VB code. 
Back to top
Login to vote
Yuvigi

External


Since: Mar 14, 2007
Posts: 4



(Msg. 4) Posted: Sat Apr 07, 2007 9:56 pm
Post subject: Re: How can I switch keyboard language from VB code. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Max.

Although I had already solved my problem, the information on the site in
your post was pretty helpful as it contained most of the information needed
to write a procedure to do the job. Thanks and good luck.

Best regards,
Rado Christov (Yuvigi)
Smile

"Max Kudrenko" wrote:

> Yuvigi,
>
> Check the ActivateKeyboardLayout function. Here's a good example of
> its use at the bottom: http://allapi.mentalis.org/apilist/ActivateKeyboardLayout.shtml
>
> Hope this helps,
>
> Max Kudrenko
> Brainbench MVP Program for Visual Basic
> www.brainbench.com
>
>
> On Mar 14, 1:01 pm, Yuvigi wrote:
> > I am writing an MS Access application. Text in some controls on forms must be
> > typed in Cyrillic, in others - in English. How can I change keyboard language
> > from code upon entering certain control?
>
>
 >> Stay informed about: How can I switch keyboard language from VB code. 
Back to top
Login to vote
Yuvigi

External


Since: Mar 14, 2007
Posts: 4



(Msg. 5) Posted: Sat Apr 07, 2007 10:14 pm
Post subject: Re: How can I switch keyboard language from VB code. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Richard!

I have already solved my problem. It took some further reading but I
eventually achieved it.

Thanks and best regards,

Rado Christov (Yuvigi)
Smile

"Richard T. Edwards" wrote:

> You might want to try using WMI.
>
>
> "Yuvigi" wrote in message
>
> >I am writing an MS Access application. Text in some controls on forms must
> >be
> > typed in Cyrillic, in others - in English. How can I change keyboard
> > language
> > from code upon entering certain control?
>
>
 >> Stay informed about: How can I switch keyboard language from VB code. 
Back to top
Login to vote
Yuvigi

External


Since: Mar 14, 2007
Posts: 4



(Msg. 6) Posted: Fri Oct 31, 2008 1:34 pm
Post subject: Re: How can I switch keyboard language from VB code. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello "DesignStudio",

Although I live by the sea I've only dived once in my life. It was a very
enjoyable experience, I decompressed alright and everything but for the next
couple of months I had problems with my right ear. So I stick to swimming on
the surface Smile
My e-mail is and you're welcome to BG any time.

Best regards


"DesignStudio" wrote:

> Dear Yuvigi,
>
> Thanks for your help. I'll try that and let you know if it didn't work.
>
> By the way I am a scuba diver and I have read about the Bulgarian Black Sea
> coast. I really would love to dive there in the future.
> This is my email .
>
> Thanks a lot.
>
>
>
> "Yuvigi" wrote:
>
> > Dear DesignStudio,
> >
> > It's pretty easy once you've grasped the logic. The bulk of time wasted is
> > to namely understand the logic. The rest is simple.
> >
> > Here is a little function I wrote, which can be called from any event in my
> > programme. It changes the keyboard layout to the desired one, provided it is
> > installed. If the desired layout has not been installed, the function
> > displays a message to the user.
> >
> > I use this code in a MSAccess application. It utilises a table called
> > "Locales" that stores information about different locales and languages.
> > Below is and excerp from the table:
> >
> > LCID Locale Language LCName Tag
> > CP_ANSI acPLID
> >
> > &H0402 Bulgarian (Bulgaria) Bulgarian bg-BG Cyrl 1251
> > 4
> > &H0407 German (Germany) German de-DE Latn 1252 9
> > &H0409 English (United States) English en-US Latn 1252
> > 11
> >
> > And here is the code:
> >
> > Public Function Lang_Keyboard_Change(Optional ByVal sArg As String =
> > "&H0409", _
> > Optional ByVal sArgType As String =
> > "LCID" _
> > ) As Boolean
> >
> > 'This function changes the keyboard language to the desired one.
> > 'It assumes that the system default language is English(Primary language
> > code = 0x09.
> > 'and that its hex code is passed by default.
> > 'If another locale argument's value is passed as an argument, then
> > 'the function looks up the LCID value in the Locales table.
> > 'If the language is installed, its layout is activated.
> > 'Else a message is displayed to the user and current language
> > 'layout is kept.
> >
> > Dim sA As String, sB As String, sC As String
> > Dim lA As Long, lB As Long, lC As Long
> >
> > On Error GoTo Err_1
> >
> > If sArgType = "LCID" Then
> > lB = Val(Replace(sArg, "0x", "&H"))
> > Else
> > sA = sArgType & "='" & sArg & "'"
> > sB = Nz(DLookup("LCID", "Locales", sA))
> > If sB = "" Then
> > 'Unsupported or wrong locale.
> > ' MsgBox SM(6571) & vbCr & sArgType & "='" & sArg & "'"
> > MsgBox "Wrong or unsupported regional settings." & vbCr _
> > & sArgType & "='" & sArg & "'"
> > Exit Function
> > End If
> > sB = Replace(sB, "0x", "&H")
> > lB = Val(sB)
> > End If
> >
> > 'Extract language code and save it to a variable.
> > lB = lB And &HFFFF&
> >
> > 'lB is the Target KB value.
> >
> > If lB = 0 Then
> > 'Target KB Language is the system language, so go to true exit.
> > GoTo Exit_True
> > End If
> >
> > 'Get initial/current layout name.
> > lA = GetKeyboardLayout(0)
> >
> > 'Exit if GetKeyboardLayout function failed.
> > If lA = 0 Then
> > Exit Function
> > End If
> >
> > 'Extract language code and save it to a variable.
> > lA = lA And &HFFFF&
> >
> > 'lA is the Initial KB value.
> >
> > 'Check if this is the desired language code.
> > If lA = lB Then
> > 'Language is the same, so go to true exit.
> > GoTo Exit_True
> > End If
> >
> > 'Activate the previous keyboard layout.
> > lC = ActivateKeyboardLayout(HKL_PREV, KLF_ACTIVATE)
> > 'Get layout.
> > lC = GetKeyboardLayout(0)
> > 'Extract language code.
> > lC = lC And &HFFFF&
> >
> > 'Loop through installed keyboard layouts
> > 'until the desired language is loaded or
> > 'loop completes a full cycle.
> > Do
> > If lC = lB Then
> > 'This is the needed language, so exit
> > 'loop and go to true exit.
> > GoTo Exit_True
> > End If
> >
> > 'Activate the previous keyboard layout.
> > lC = ActivateKeyboardLayout(HKL_PREV, KLF_ACTIVATE)
> > 'Get layout.
> > lC = GetKeyboardLayout(0)
> > 'Extract language code.
> > lC = lC And &HFFFF&
> > Loop While lC <> lA
> >
> > 'The desired keyboard layout is not installed on the system.
> > 'Display a message to the user.
> > If sArgType = "LCID" Then
> > sA = sArgType & "='" & Replace(sArg, "0x", "&H") & "'"
> > Else
> > sA = sArgType & "='" & sArg & "'"
> > End If
> > sB = Nz(DLookup("Locale", "Locales", sA))
> > MsgBox sB & vbCrLf & "The desired keyboard layout is not installed on
> > the system." _
> > & "Install it first from Control Panel > " _
> > & "Regional and Language Options.", vbInformation, sAppTitle
> > Exit_False:
> > Exit Function
> >
> > Exit_True:
> > Lang_Keyboard_Change = True
> >
> > Exit_1:
> > Exit Function
> >
> > Err_1:
> > MsgBox Err.Description, vbExclamation, sAppTitle
> > Resume Exit_1
> >
> > End Function
> >
> > I hope you find this post usefull. It works fine for me.
> > Good luck.
> > Best wishes from Bulgaria!
> >
> >
> > "DesignStudio" wrote:
> >
> > > Dear Yuvigi,
> > > Could you please share with us how you solved your problem?
> > >
> > >
> > > "Yuvigi" wrote:
> > >
> > > > Thanks Max.
> > > >
> > > > Although I had already solved my problem, the information on the site in
> > > > your post was pretty helpful as it contained most of the information needed
> > > > to write a procedure to do the job. Thanks and good luck.
> > > >
> > > > Best regards,
> > > > Rado Christov (Yuvigi)
> > > > Smile
> > > >
> > > > "Max Kudrenko" wrote:
> > > >
> > > > > Yuvigi,
> > > > >
> > > > > Check the ActivateKeyboardLayout function. Here's a good example of
> > > > > its use at the bottom: http://allapi.mentalis.org/apilist/ActivateKeyboardLayout.shtml
> > > > >
> > > > > Hope this helps,
> > > > >
> > > > > Max Kudrenko
> > > > > Brainbench MVP Program for Visual Basic
> > > > > www.brainbench.com
> > > > >
> > > > >
> > > > > On Mar 14, 1:01 pm, Yuvigi wrote:
> > > > > > I am writing an MS Access application. Text in some controls on forms must be
> > > > > > typed in Cyrillic, in others - in English. How can I change keyboard language
> > > > > > from code upon entering certain control?
> > > > >
> > > > >
 >> Stay informed about: How can I switch keyboard language from VB code. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
strange! vb6+access2002 - I have a mdb called treesy.mdb.There is a table,named transcipt with three fields:serial_no, eng,sound serial_no:1-10 (10 numbers) eng: 1.The movie has been on for 15 minutes, madam.@ 2.Oh, my god!@ It's 7:45 now!@ 3.Is Helen coming?@ It¡¯s 6:50 now.@..

Authentication Error??? - Ok so heres the code.. for some reason I kept getting the no permissions message, so I attempted to add the access workgroup file. Now I get the "Authentication Failed" message. This is a secure database. HELP.. I know I'm writing (adding) som...

Database Access Crashes on Windows 2003 Terminal Server - I have been running a Microsoft Access 97 application on Windows 2003 Terminal Server for almost a year now, with no problems. About two weeks ago, I started to get the following errors in my event log: Application Error; EventID: 1000 Faulting..

Software Engineers required for USA - Dear Sir, Kraftware Inc. Software Engineers required for USA We are a leading software consulting company based in Nebraska (Omaha) Growing in business for the past 9 yrs. We are currently Experiencing Growth and we are Hiring Software Engineers for..

Clipboard content to Access field - Hello: How can I paste a bitmap image in clipboard to an Access field using VB? Thank you in advance.
   Database Forums (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]