Is there any way to switch IMEs in one KeyboardLayout?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Giresharu
Posts: 14
Joined: 16 Apr 2024, 07:21
Contact:

Is there any way to switch IMEs in one KeyboardLayout?

22 Apr 2024, 12:27

This code is known to toggle KeyboardLayout:

Code: Select all

 SendMessage(0x50, , kblCode, , imeWinId, , , , 1000)
It can switch the IME between English, Chinese, Japnese, and so on.
But It can't specify which specific IME to use for the switching KeyboardLayout.

In Chinese, there are often many different IMEs that can be used for input.
Such as the character shape IME called Wubi, the phonetic IME called Pinyin, and so on.
(They are different IME software, not different states of an IME software.)

Is there any way to switch them?
The Windows API is a bit large and not easily accessible, does anyone know anything about it and what dll or message to use to switch to a non-default IME of a layout?
User avatar
Seven0528
Posts: 394
Joined: 23 Jan 2023, 04:52
Location: South Korea
Contact:

Re: Is there any way to switch IMEs in one KeyboardLayout?

22 Apr 2024, 14:16

 I'm currently working on developing a program to address this issue. (I haven't released it yet.)
As you mentioned, simply using WM_INPUTLANGCHANGEREQUEST is not sufficient to switch to a specific input method in Chinese, Japanese, or Korean.
Although there's a method called ITfInputProcessorProfileMgr::ActivateProfile, it's more suitable for selecting input methods within the own process rather than controlling input methods in other processes (even if you combine it with the TF_IPPMF_FORSESSION flag).

You've probably done a lot of searching, but as you know, there's very little information available on this issue.
The only method I can suggest is registering a key sequence for the desired input method in "Text Services and Input Languages" and then using SendInput to trigger it. It's an indirect approach, but it should work fine.

First, press Windows + R and execute the command:

Code: Select all

"rundll32.exe" Shell32.dll,Control_RunDLL input.dll,,{C07337D3-DB2C-4D0B-9A93-B722A6C106E2}{HOTKEYS}
Then, register a key sequence for your desired input method, such as Microsoft Pinyin, and try using SendInput in AHK to trigger it.
20240423_041512.png
(656.75 KiB) Downloaded 70 times
  • English is not my native language. Please forgive any awkward expressions.
  • 영어는 제 모국어가 아닙니다. 어색한 표현이 있어도 양해해 주세요.
garry
Posts: 3787
Joined: 22 Dec 2013, 12:50

Re: Is there any way to switch IMEs in one KeyboardLayout?

23 Apr 2024, 07:30

it's also possible to run the command with ahk-script
( in german WIN-11 I see only 3 languages (?) )

Code: Select all

#Requires AutoHotkey v2
;Run,%comspec% /k rundll32.exe Shell32.dll`,Control_RunDLL input.dll`,`,{C07337D3-DB2C-4D0B-9A93-B722A6C106E2}{HOTKEYS}  ;- V1
Runwait("rundll32.exe Shell32.dll,Control_RunDLL input.dll,,{C07337D3-DB2C-4D0B-9A93-B722A6C106E2}{HOTKEYS}")
ExitApp()

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: diegg1739, mikeyww, WarlordAkamu67 and 46 guests