Rebind Keyboard

Rebind Keyboard

Post by Dermott on Tue Sep 16, 2008 8:56 pm
([msg=11884]see Rebind Keyboard[/msg])

hey guys, i was wondering how i can rebind a keyboard using code.

What i am trying to accomplish is a program that runs in the background (preferably) and could change something.

So lets say I want it to replace the word "the" with "at" everytime it is written.

I was thinking of doing this somehow along the lines of saying if a string of "t h e" == yes then replace with "a t"

How would i do this...

Open to all suggestions.
Dermott
New User
New User
 
Posts: 3
Joined: Tue Sep 02, 2008 3:16 pm
Blog: View Blog (0)


Re: Rebind Keyboard

Post by BhaaL on Wed Sep 17, 2008 11:10 am
([msg=11911]see Re: Rebind Keyboard[/msg])

The only way to do this would be a global key hook. Most virus scanners detect the use of this API as keylogger tho, at least the retarded ones do. Anyways, you may want to look into GetAsyncKeyState.
Keep a buffer of what was typed last, and use SendKeys to work around that. Replacing "the" with "at" would require the buffer to be "the", and sending three backspaces (to delete "the") before sending "at".

Besides, why would one want to do that?
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)


Re: Rebind Keyboard

Post by Dermott on Wed Sep 17, 2008 3:25 pm
([msg=11923]see Re: Rebind Keyboard[/msg])

So is there no way to do this through programming?

And to answer why I would want to do this, I don't necessarily want to do that, but knowing how to do that would be a concept that will help me out with various things.
Dermott
New User
New User
 
Posts: 3
Joined: Tue Sep 02, 2008 3:16 pm
Blog: View Blog (0)


Re: Rebind Keyboard

Post by BhaaL on Thu Sep 18, 2008 11:04 am
([msg=11974]see Re: Rebind Keyboard[/msg])

Its not impossible, but theres no ideal way to do it, especially not for cross-platform applications that should run on both win32 and linux for example.
If you want to do Hotkeys, there are other ways, check out RegisterGlobalHotkey. For keyloggers, GetAsyncKeyState. To simulate input, SendKeys. Whatever you need/use is up to what you want to do.
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)



Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests