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

CHAN Samuel 20 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?

Windows development | Windows API - Win32
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
Developer technologies | C#
Developer technologies | 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.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Castorix31 91,196 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 45 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,546 Reputation points Microsoft External Staff
    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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.