Vb.net
I have hooked the keyboard.
When i press "s" key it sends "d"char(thats what i wanted)
but the problem is when i press ctrl+s notepad does not save the doc and sends "d".
How to solve this.

Recommended Answers

All 3 Replies

It is likely that dirt in your keyboard is causing this. Get some compressed air and blow the dirt, dust, and detritis out of the keyboard (also holding it upside down and shaking sometimes will dislodge stuff stuck inside). Then try again.

You have done keyboard hook with SetWindowsHookEx() API call, right?
When your keyboard delegate gets keycode for S-key, it replaces it with D-key's keycode (for some reason I do not understand), right?
You do know that Ctrl+S sends two separate keycodes, one for Ctrl-key and one for S-key, right?
Now if you press Ctrl+S, your keyboard delegate handles Ctrl-key and then replaces S-key's code with D-key's code, right?
Now if you press Ctrl+S in the Notepad it gets Ctrl+D and Ctrl+D does not save the document, right?

You solve this problem by not replacing S-key with D-key in your keyboard delegate. Right?

HTH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.