Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just found that direct integration of IME is blocked in Windows 8, moving on to TSF now. By now, there is lack of Microsoft's Document about TSF, this will be hard.

I am using SharpDX and the RenderForm. However, when I execute the game, IME is disabled and I can only capture English chars.

Hot Keys are not working. I tried using

ImmSetOpenStatus(imeContext, true);


this.ImeMode = System.Windows.Forms.ImeMode.On;

but nope, not working, and I tried to disable DirectInput in the game, still can not switch on the IME.

Are there any window message that tells IME to open? Here is my code of capturing window's message:

    protected override void WndProc(ref Message m)
        if (m.Msg == WindowMessage.InputLanguageChange)
        if (m.Msg == WindowMessage.ImeSetContext && m.WParam.ToInt32() == 1)
            IntPtr imeContext = ImmGetContext(this.Handle);
            if (context == IntPtr.Zero)
                context = imeContext;
            ImmSetOpenStatus(imeContext, true);
            ImmAssociateContext(this.Handle, context);
        base.WndProc(ref m);

        switch (m.Msg)
            case (int)WindowMessages.WM_GETDLGCODE:
                if (Is32Bit)
                    int returnCode = m.Result.ToInt32();
                    returnCode |= (DLGC_WANTALLKEYS | DLGC_WANTCHARS);
                    m.Result = new IntPtr(returnCode);
                    long returnCode = m.Result.ToInt64();
                    returnCode |= (DLGC_WANTALLKEYS | DLGC_WANTCHARS);
                    m.Result = new IntPtr(returnCode);
            case (int)WindowMessages.WM_CHAR:
                int charInt = m.WParam.ToInt32();
                InputChar InputChar = new InputChar();
                InputChar.IsUsed = false;
                InputChar.Chars = (char)charInt;
                    switch (charInt)
                        case 8:
                            InputChar.CharacterType = charType.BackSpace;
                        case 9:
                            InputChar.CharacterType = charType.Tab;
                        case 13:
                            InputChar.CharacterType = charType.Enter;
                        case 27:
                            InputChar.CharacterType = charType.Esc;
                            InputChar.CharacterType = charType.Char;
                    if (OnInput != null)
                        OnInput(this, InputString);

Hope you guys can help me, really don't know what to do now.

share|improve this question
I have just tested the winform example from SharpDX, I found that if I clicked on the controls provided by Microsoft, IME will be switched on, and if i clicked on the render control provided by SharpDX, IME will be switched off. May be the solution is to switch on IME on custom controls? How to do this? – Alex Mak Apr 25 '13 at 3:56
While searching Microsoft's API (Control Class), Found a boolean called "CanEnableIme" which determinate if I can enable IME but it is false. And there is a remark of this property "false in all case." in ContainerControl, "true in all case" in Control. Control.CanEnableIME API:… ContainerControl.CanEnableIME API:… – Alex Mak Apr 25 '13 at 4:04
Bool "CanEnableIME" from RenderForm is ContainerControl's one, In the API said to enable IME in ContainerControl manually is to override this boolean and return true. However, still can not switch on IME after overriding. – Alex Mak Apr 25 '13 at 4:12
More findings, while google about IMM, a staff from Microsoft said that IMM is not enabled because IMM is not told that the Windows Forms is typing. As the form is not a "Text Area" like Textbox and etc. So the problem is how to tell IMM that the Form client is a text area? – Alex Mak Apr 25 '13 at 10:04
up vote 2 down vote accepted

Finally figured out why I can't activate IME supports.

Please correct me if my concept is wrong.

Concept Behind

In windows 8, the default Input method provided is "TSF". While referring to the documents from Microsoft, TSF is a service below IME, which means IME uses TSF to provide Text service. However TSF support different input "source" ( Voice input, Pen input and etc. )

IME only integrated with the keyboard input part of TSF, so Microsoft is trying to make developer and user to use TSF instead of IME. ( To force support the tablet "Surface" I think? )

So, if you capture the IME's window messages it will return nothing. Because the OS is not using an IME input method.


Install IME input method or legacy input method from Windows 7 and below, which is using IME not TSF.

I have installed a Chinese Windows 8 input method which is using IME, and everything works fine. There is no problem or bug in the code.

share|improve this answer
If you have a link where you found this, it would be awesome, so other people can read and learn more about this – Panda Pajama Jan 27 '14 at 7:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.