예제 #1
0
        public void SwitchToLanguage(int index)
        {
            UsedInputLanguage usedInputLanguage = usedInputLanguages[index];

            usedInputLanguages.RemoveAt(index);
            usedInputLanguages.Insert(0, usedInputLanguage);
            TemporaryInputLanguage = 0;
        }
        /// <summary>
        /// Sends WM_INPUTLANGCHANGEREQUEST to given window and some of it's childs
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="language"></param>
        public void InputLangChangeRequest(IntPtr hwnd, UsedInputLanguage language)
        {
            IntPtr targetHandle  = language.InputLanguage.Handle;
            IntPtr currentHandle = GetUserInputLanguageHandle(hwnd);

            //hwnd = GetRootOwner();

            if (hwnd != null /*&& targetHandle != currentHandle*/)
            {
                InputLanguageRequest(hwnd, targetHandle);

                StringBuilder buf = new StringBuilder(100);
                GetClassName(hwnd, buf, 100);

                //if this is a dialog class then post message to all descendants
                if (buf.ToString() == "#32770")
                {
                    EnumChildWindows(hwnd, InputLanguageRequest, targetHandle);
                }
            }

            //SetDefaultInputLang(language);
        }
 private bool SetDefaultInputLang(UsedInputLanguage inputLanguage)
 {
     //return SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, inputLanguage.InputLanguage.Handle.ToInt32() & 0xffff, 0); // doesn't work
     return(SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, (int)inputLanguage.InputLanguage.Handle, 0)); // doesn't work
 }
 public void InputLangChangeRequestFocused(UsedInputLanguage language)
 {
     hwnd = GetRootOwner();
     InputLangChangeRequest(hwnd, language);
 }
 public void InputLangChangeRequestForChildsIfRequired(IntPtr hwnd, UsedInputLanguage language)
 {
     IntPtr handle = language.InputLanguage.Handle;
 }