public static IntPtr SetHook(HandleKeyPress handleKeyPress) { WindowHelper.handleKeyPress = handleKeyPress; using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { return(SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0)); } }
/// <summary> /// Initializes a new instance of the <see cref="TextBoxItems"/> class. /// </summary> /// <param name="fieldname">The fieldname.</param> /// <param name="presetvalue">The presetvalue.</param> /// <param name="handleKeyPressH">The handle key press h.</param> /// <param name="acceptFinalTextBoxTextH">The accept final text box text h.</param> /// <param name="errortext">The errortext.</param> public TextBoxItems(string fieldname, string presetvalue = "", HandleKeyPress handleKeyPressH = null, AcceptFinalTextBoxText acceptFinalTextBoxTextH = null, string errortext = "") { AcceptFinalText = acceptFinalTextBoxTextH; FinalTextError = errortext; HandleKeyPress = handleKeyPressH; LabelText = fieldname; TextBoxName = fieldname; TextBoxPreSetText = presetvalue; }
internal virtual void RegisterKeyInput() { if (keyInputRegistered) { return; } keyType = new HandleKeyType(HandleKeyType); keyPress = new HandleKeyPress(HandleKeyPress); keyRelease = new HandleKeyRelease(HandleKeyRelease); KeyboardInput.Instance.KeyTypeEvent += keyType; KeyboardInput.Instance.KeyPressEvent += keyPress; KeyboardInput.Instance.KeyReleaseEvent += keyRelease; keyInputRegistered = true; }
internal virtual void RegisterKeyInput() { if (keyInputRegistered) return; keyType = new HandleKeyType(HandleKeyType); keyPress = new HandleKeyPress(HandleKeyPress); keyRelease = new HandleKeyRelease(HandleKeyRelease); KeyboardInput.Instance.KeyTypeEvent += keyType; KeyboardInput.Instance.KeyPressEvent += keyPress; KeyboardInput.Instance.KeyReleaseEvent += keyRelease; keyInputRegistered = true; }