コード例 #1
0
        /// <summary>
        /// Loads the items to be searched from a reference file and converts to KeyInputCodes
        /// </summary>
        /// <returns>array of KeyInputCode[]'s which contain the KeyInputCodes for an item </returns>
        public KeyInputCode[][] LoadSearchItems()
        {
            string[]         items             = LoadItemsFromFile();
            KeyInputCode[][] allItemInputCodes = new KeyInputCode[items.Length][];

            for (int i = 0; i < items.Length; i++)
            {
                char[]         itemCharacters = items[i].ToCharArray();
                KeyInputCode[] itemInputCodes = new KeyInputCode[itemCharacters.Length];
                for (int j = 0; j < itemCharacters.Length; j++)
                {
                    itemInputCodes[j] = GetKeyInputCodeFromChar(itemCharacters[j]);
                }

                allItemInputCodes[i] = itemInputCodes;
            }

            return(allItemInputCodes);
        }
コード例 #2
0
 /// <summary>
 /// presses a key for a respective keyCode
 /// </summary>
 /// <param name="keyCode">code for specified key</param>
 public void PressKey(KeyInputCode keyCode)
 {
     keybd_event((byte)keyCode, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
     keybd_event((byte)keyCode, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
 }