in WPF Window,
WindowInteropHelper h = new WindowInteropHelper(this);
IntPtr hK = ImmGetContext(h.Handle);
ImmGetContext returns 0 always. In the contrary, In Windows Form, It works properly.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I believe we ran into this issue too.
For our app we ended up overriding WindowProc and use the hwnd which comes in there with WM_IME_COMPOSITION message and passing that to ImmGetContext().
We set up the WindowProc in OnSourceInitialized. (our code is c++/cli so this C# may not be exact)