public static void Send(String str, int start) { for (int i = start; i < str.Length; i++) { SendKey(VkToChar.GetVkCode(str[i])); } }
public static void Send(StringBuilder sb, int start, int len) { for (int i = start; i < len; i++) { SendKey(VkToChar.GetVkCode(sb[i])); } }
public static void Send(string str) { for (int i = 0; i < str.Length; i++) { SendKey(VkToChar.GetVkCode(str[i])); } }
public static void Send(char[] arr, int start, int len) { for (int i = start; i < len; i++) { SendKey(VkToChar.GetVkCode(arr[i])); } }
private static IntPtr ActiveCallback(int nCode, IntPtr wParam, IntPtr lParam) { currentWindow = WindowInfo.GetActiveWindowInfo(); currentLang = currentWindow.keyboardLayout & 0xFFFF; int vkCode = Marshal.ReadInt32(lParam); int flags = Marshal.ReadInt32(lParam + 8); if (vkCode == 0x76) // F7 { active = false; Deactivated?.Invoke(); } if ((flags & 16) != 0) { return(IntPtr.Zero); // инжектиран } if (vkCode == 0x26 || vkCode == 0x28) // up & down { if (ArrowKeysPressed != null) { if (ArrowKeysPressed(vkCode == 0x26)) { return((IntPtr)1); } else { return(IntPtr.Zero); } } } else if (vkCode == 8) { CharacterRemoved?.Invoke(); return(IntPtr.Zero); } char ch = VkToChar.GetChar(vkCode, currentLang); bool cond1 = (lastWindow != null) && (!currentWindow.Equals(lastWindow)); bool cond2 = (lastLang != 0) && (currentLang != lastLang); bool terminateWord = cond1 || cond2; if (terminateWord) { Console.WriteLine("{0} {1}", cond1, cond2); } bool block = false; if (terminateWord) { WordActionHappened?.Invoke(WordAction.WordTerminated); } if (vkCode == tabCode) { block = AutoCompleteRequested != null?AutoCompleteRequested() : false; } else if (endCodes.Contains(vkCode)) { WordActionHappened?.Invoke(WordAction.WordCompleted); } else if (ch != 0) { CharacterAdded?.Invoke(ch); } else { WordActionHappened?.Invoke(WordAction.WordTerminated); } lastLang = currentLang; lastWindow = currentWindow; if (block) { return((IntPtr)1); } else { return(IntPtr.Zero); } }