Esempio n. 1
0
        public static void Initialize(GameWindow window)
        {
            if (initialized)
            {
                throw new InvalidOperationException("KeyboardInput.Initialize can only be called once!");
            }

            hookProcDelegate = new WndProc(HookProc);
            //set Wnd long before Init IME
            SetWindowLong(window.Handle, GWL_WNDPROC, (int)Marshal.GetFunctionPointerForDelegate(hookProcDelegate));

            ImmReleaseContext(window.Handle, (IntPtr)Traverse.Create(typeof(KeyboardInput)).Field("hIMC").GetValue());

            api = new IMM();
            api.Initialize(window.Handle);
            //Composition
            api.m_compositionHandler.eventComposition += IMEControl_CompositionEvent;
            api.m_compositionHandler.eventGetTextExt  += IMEControl_GetCompExtEvent;

            prevWndProc = (IntPtr)Traverse.Create(typeof(KeyboardInput)).Field("prevWndProc").GetValue();

            CharEntered += KeyboardInput__CharEntered;
            KeyDown     += KeyboardInput__KeyDown;

            initialized = true;
        }
Esempio n. 2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //api = new IMM();
     api = new TSF();
     initIMEControl();
 }