Thanks! I'll go mess around with my hooking code.
digiwombat
Posts
-
Kill key strokes while hooked -
Kill key strokes while hookedOk, I am just going to use blockinput() I think. It blocks the mouse too, but oh well.
-
Kill key strokes while hookedAlso, I am using WH_KEYBOARD_LL to hook, if that helps out more.
-
Kill key strokes while hookedIt is a global keyboard hook. I am using the Kennedy.ManagedHooks DLL from this site. I enable it with a hotkey, and disable it the same way.
public Form1() { // Alt = 1, Ctrl = 2, Shift = 4, Win = 8 Form1.RegisterHotKey(this.Handle,this.GetType().GetHashCode(), 8, (int)'P'); InitializeComponent(); keyboardHook = new Kennedy.ManagedHooks.KeyboardTracking(); keyboardHook.KeyboardEvent += new Kennedy.ManagedHooks.KeyboardTracking.KeyboardEventHandler(keyboardHook_KeyboardEventExt); } protected override void WndProc(ref Message m) { if (m.Msg == 0x0312) if (keyboardHook.IsHooked) { keyboardHook.UninstallHook(); input = false; textBox4.Text = ""; } else { textBox4.Text = ""; keyboardHook.InstallHook(); input = true; } base.WndProc(ref m); } private void keyboardHook_KeyboardEventExt(Kennedy.ManagedHooks.KeyboardEvents kEvent, Keys key) { bool shi; if(keyboardHook.ShiftPressed == true) shi = true; else shi = false; if(kEvent == KeyboardEvents.KeyDown){ string msg; //snipped out some key parsing junk. if(shi == true) msg = key.ToString(); else msg = key.ToString().ToLower(); textBox4.Text += msg; } }
I think that covers all the relevant code from my end of the application. If there are any questions about what anything does more specifically, I can answer those. The Hotkey works fine, and I am planning to add the message filter or whatever when it hotkeys in and remove it when they hotkey out of the hook, obviously. Thanks for the help thus far. -
openFileDialog help neededYou want to dispose of the parent form, or just hide the form that the open file dialog will lead to? Because if you just hid the receiving dialog, you could just hide the dialog onload and show the openFileDialog. That'd work, right?
-
Kill key strokes while hookedJust *can't* figure out. Why is it that we always leave out the mosti mportant words? haha.
-
Stupid CheckBox Behavior, please help!!George's replies line up with what I've found, but if it's still messing up for you, you could always set a variable with the click function and with the code, and check that variable on check changed before you run anything else. if(clicked == false) //click toggled else //code toggled
-
Kill key strokes while hookedOk, I am using a global hook, and I am wondering how I can keep the keys from sending to the active program. I searched around the net and CodeProject and I just can't figure it out. I'm not terribly familiar with WindowsAPI stuff. Thanks in advance. -- modified at 19:33 Friday 17th February, 2006