Open stuncloud opened 1 month ago
IMEが無効になってしまう原因がなにかしらあると思われるが、全く見当がつかないのでひとまず対症療法的な対応を試みる
このケースではWINNLSEnableIMEが有効かもしれない 以下のように利用されている
https://radioc.web.fc2.com/weblib/ms/dev16/402022.htm
発生状況が似通っており、効果も期待できる
この現象についてgeminiに聞いてみた結果
The issue you're experiencing with IME being disabled after closing a dialog and then reopening one with an edit control could be caused by several factors related to the Win32 API and IME interactions. Here are some potential causes to investigate:
IME Context Disassociation:
When you close the first dialog, the IME context associated with the edit control might be getting dissociated from the window. This can happen if the dialog's HWND
is destroyed or if the IME context is explicitly removed using functions like ImmDestroyContext
. When you reopen the dialog with the edit control, a new IME context needs to be created and associated with the control, but this might not be happening correctly due to the previous context being lost.
IME Thread Issues:
IME functionality is managed on a per-thread basis. If the IME thread is terminated or restarted after closing the first dialog, it could disrupt the IME context association and cause IME to be disabled in the subsequent dialog.
Dialog Creation Flags:
The flags used when creating the dialog windows might be affecting the IME behavior. Check if you're using flags like WS_EX_NOIME
or WS_EX_NOINPUTIME
that could be intentionally disabling IME for the dialogs.
IME Configuration Changes:
If the user or a program modifies the IME configuration settings between closing and reopening the dialogs, it could lead to IME being disabled in the second dialog. This might involve changes to input locales, IME hotkeys, or other IME-related settings.
Third-party IME Interference:
If you're using a third-party IME instead of the default Windows IME, there might be compatibility issues or bugs in the third-party IME that are causing the problem. Try switching back to the default IME temporarily to see if the issue persists.
To troubleshoot the issue effectively, consider these steps:
Debug IME Context Association:
Use IME management functions like ImmGetContext
and ImmAssociateContext
to track the IME context association state throughout the process of closing and reopening the dialogs. Check if the context is being properly associated with the edit control's window handle.
Verify IME Thread Stability:
Ensure that the IME thread is not being terminated or restarted unexpectedly. Use debugging tools to monitor thread creation and destruction events.
Review Dialog Creation Flags:
Double-check the flags used when creating the dialog windows to ensure they are not explicitly disabling IME. Remove any unnecessary flags that might be affecting IME behavior.
Monitor IME Configuration Changes:
Track any changes to IME configuration settings using system events or IME notification mechanisms. Identify if any configuration changes coincide with the IME being disabled.
Test with Default IME:
Temporarily switch to the default Windows IME and check if the issue persists. If the problem disappears, investigate compatibility issues with the third-party IME.
By carefully examining these potential causes and following the troubleshooting steps, you should be able to pinpoint the root cause of the IME disablement issue and implement appropriate solutions to restore proper IME functionality in your Win32 dialogs.
WINNLSEnableIME
では解決せず
のいずれにも効果なし
input関数を二度呼び、最初の正常な状態と次の現象発生状態を比較すると以下の通り
初回 | 現象発生時 | 備考 | |
---|---|---|---|
タスクバー表示 | 表示あり | 表示なし (※1) | |
WINNLSEnableIME | TRUE | TRUE | IMEは無効になっていないっぽい |
ImmGetContext | 正常に取得可 | 正常に取得可 | IME自体は存在しているっぽい |
ImmGetOpenStatus | FALSE | 初回の状態を返す | 初回にIMEオンならTRUE、オフならFALSE |
ImmSetOpenStatusをTRUE | 影響なし | 影響なし | 初回もIMEオンにならない |
ImmGetConversionStatus | |||
lpfdwconversion | IME_CONVERSION_MODE(25) | IME_CONVERSION_MODE(9) | ※2 |
lpfdwsentence | IME_SENTENCE_MODE(8) | IME_SENTENCE_MODE(8) | |
ImmSetConversionStatus | 25にしても影響なし | ※3 |
ImmSimulateHotKey
でIME_JHOTKEY_CLOSE_OPEN
すると表示される (Google IMEの場合)
IME_CMODE_NATIVE
は入っている
IME_CMODE_NATIVE|IME_CMODE_FULLSHAPE|IME_CMODE_ROMAN
IME_CMODE_NATIVE|IME_CMODE_FULLSHAPE
Windows 11でも再現した
SetFocus
, SetForegroundWindow
, SetActiveWindow
を試している
概要
なにかしらのダイアログ (msgbox, input, slctbox) を表示後にinputダイアログを表示すると、そのダイアログに対してIMEが使用できなくなる
再現スクリプト
再現手順
No response
バージョン
1.0.1
不具合発生環境
Windows 10