ContextMenuStrip and LowLevelKeyboardHook

benc5081

New member
Joined
Dec 26, 2008
Messages
2
Programming Experience
Beginner
Hello! This is my first post to these forums.
Here is my scenario, I have a lowlevelkeyboard hook in my program. The keydown event checks the active window title to see if a microsoft word document is open, and when the letter 'y' is pressed a contextmenustrip is called.
Everything works great except for the arrow keys. When the contextmenustrip is visible, the arrow keys will not select or move through items in the contextmenustrip. I set up some IF statements to check if the contextmenustrip is open, and when it is the up/down arrow keys select the next item in the menu. The problem is that the word document has actual focus and the up/down keys are still sent to the word document (causing the line the cursor is on.)
I have tried using e.suppresskey in the keydown event to try to prevent this, but the keys are still pressed on the word document. Any suggestions?
 
Also, have tried using combinations of contextmenustrip1.focus and e.handled... can get the code to work only sometimes, without any consistency at all.
 
Back
Top