Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputChar"></param>
        /// <param name="checkText"></param>
        /// <returns></returns>
        public static bool IsMatchToHebMnemonicForText(char inputChar, string checkText)
        {
            bool isMatchToHebMnemonic = false;

            // get the accelerator of the control
            char acc = GetAcclerator(checkText);

            // If this Hebrew char
            if (IsUnicodeHeb(acc))
            {
                // get the scan code of the char
                long scanCodeOfAccelarator = GuiHebChar2ScanCode((long)acc);
                if (scanCodeOfAccelarator != 0)
                {
                    char charInEngOgAccelarator = (char)NativeWindowCommon.MapVirtualKey((uint)scanCodeOfAccelarator, NativeWindowCommon.MAPVK_VSC_TO_VK);
                    inputChar = Char.ToUpper(inputChar);

                    if (inputChar.Equals(charInEngOgAccelarator))
                    {
                        isMatchToHebMnemonic = true;
                    }
                }
            }
            return(isMatchToHebMnemonic);
        }
Пример #2
0
        /// <summary>
        /// Sends KeyDown and KeyUp messages to the window
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="keyCode"></param>
        /// <param name="extended"></param>
        public static void SendKey(IntPtr hwnd, int keyCode, bool extended)
        {
            uint scanCode = NativeWindowCommon.MapVirtualKey((uint)keyCode, 0);
            uint lParam;

            //KEY DOWN
            lParam = (0x00000001 | (scanCode << 16));
            if (extended)
            {
                lParam = lParam | 0x01000000;
            }

            NativeWindowCommon.PostMessage(hwnd, NativeWindowCommon.WM_KEYDOWN, (int)keyCode, (int)lParam);

            //KEY UP

            NativeWindowCommon.PostMessage(hwnd, NativeWindowCommon.WM_KEYUP, (int)keyCode, (int)lParam);
        }