Programatically turn on/off Japanese IME Kana/Romaji input mode

CHAN Samuel 0 Reputation points
2024-10-03T02:46:06.51+00:00

I am trying to programmatically turn on/off Japanese Kana/Romaji input mode. This is equivalent to the "Kana input" option in the IME input menu

User's image

I have tried to use InputMethod.SetPreferredImeConversionMode but it can only sets the TextBox into Hiragana/Alphanumeric/Katakana input.

Are there any Win32 APIs we can use to change this Kana/Romaji input mode?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,095 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,609 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,900 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 84,956 Reputation points
    2024-10-03T07:21:16.48+00:00

    On my OS (Windows 10 22H2), I can change it in Registry, at the key :

    HKEY_CURRENT_USER\SOFTWARE\AppDataLow\Software\Microsoft\IME\15.0\IMEJP\MSIME

    kanaMd (0 or 1)

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. uncle_Kei 0 Reputation points
    2024-10-03T05:53:28.3166667+00:00

    I am a Japanese programmer.

    There is a function in 'Imm32.lib' called "ImmSetConversionStatus()".

    In general, it is reasonable to restrict input mode according to input items.

    However, we do not agree with the specification that the application changes the input mode of the IME.

    This is because some people prefer romaji input and some prefer hiragana input, and these people do not like to have their input mode changed without their permission. In other words, Japanese people do not like to have their IME controlled by others.

    *Translated with DeepL.com (free version)


  2. Tong Xu - MSFT 2,456 Reputation points Microsoft Vendor
    2024-10-03T06:31:20.32+00:00

    @CHAN Samuel As @uncle_Kei mentioned, You can use ImmSetConversionStatus by setting unnamedParam2 of Conversion mode values. IME_CMODE_KATAKANA, Set to 1 if KATAKANA mode; 0 if HIRAGANA mode.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.