Exemplo 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;
        }
Exemplo n.º 2
0
        private void initIMEControl()
        {
            api.Initialize(Handle);
            //Composition
            api.m_compositionHandler.eventComposition += M_compositionHandler_eventComposition;;
            api.m_compositionHandler.eventGetTextExt  += M_compositionHandler_eventGetTextExt;;

            //CandidateList
            api.m_candidateListWrapper.eventCandidateList += M_candidateListWrapper_eventCandidateList;

            //AlphaMode
            api.eventAlphaMode += Api_eventAlphaMode;

            api.setState(true);
            IMEStateChange.Text = "IMEState:" + (api.State() ? "Enabled" : "Disabled");
            IMEAPIData.Text     = api is TSF ? "TF API" : "IMM32 API";
            UILessData.Text     = api.FullScreen() ? "TRUE" : "FALSE";
        }