ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Possible to change keyboard input language programmatically ?

Solved!
Go to solution

Hi to all! So as the title says, if somebody has 2 or more input languages installed in Windows is there any way in LabVIEW to get the current language and change that to the preferred one? I have a string control which needs to accept only english characters to avoid problems

0 Kudos
Message 1 of 9
(7,169 Views)

Language bar => settings => Advanced Key Settings, create a shortcut for English.  For example Ctrl+Shift+0.

Simulate a keyboard press, and send it your window.

image.png

 

George Zou
0 Kudos
Message 2 of 9
(7,096 Views)

Another option could be to filter your input to the control by using the "key down?" event.

0 Kudos
Message 3 of 9
(7,076 Views)

Thanks, zoo.I agree that this would be an easy solution but it's kind of personal one. I don't think it would be convenient for deployment of an application

0 Kudos
Message 4 of 9
(7,056 Views)

Can we assume English (US) is installed?

 

George Zou
0 Kudos
Message 5 of 9
(7,038 Views)

Use Windows API post a message (WM_INPUTLANGUAGECHNAGEREQUEST = 0x50) to the window:

PostMessage(hWnd, 0x50, 0, 0x0409);

 

0x0409 is US English.

 

 

George Zou
Message 6 of 9
(7,019 Views)
Solution
Accepted by blackfinger

For those who are not familiar Windows API, try this llb.

 

George Zou
Message 7 of 9
(6,985 Views)

Hello Zou,

 

thank you for posting Inpullanguage.llb.

Although in my case Set InputLanguage.vi doesn't seem to work. Keyboard layout wouldn't switch when I execute it.

Enumerate InputLanguages.vi and Get Default InputLanguage.vi work just fine.

 

I wonder if it could be caused by some Windows background service not running?

In VI i'm working on I need to set ENG-US keyboard layout to avoid mistakes as user inputs data.

 

My set is as follows:

LabView 2020 full 32-bit

Windows 10 Pro x64

 

0 Kudos
Message 8 of 9
(3,479 Views)

The demo vi works fine on my Windows 11 with LabVIEW 2021.

 

image.pngimage.png

 

George Zou
0 Kudos
Message 9 of 9
(3,405 Views)