Click here to Skip to main content
15,439,117 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i am writing a program i need to change the messages that different keys send computer
for example when someone pressed 'k' i want that computer think that i pressed 'q' how can i do it i worked with hook and input but i couldnt get results in C++ win32
Updated 5-Sep-12 1:06am
JackDingler 5-Sep-12 10:41am    
Perhaps if you told us what you're trying to accomplish with this, we might be able to point you in a better direction?
ZiDoM 5-Sep-12 10:56am    
i want to ndisable space bar and send another key for example '1 to a program'
JackDingler 5-Sep-12 11:59am    
Is this a program you are writing, or an app for which you don't have source code?
ZiDoM 5-Sep-12 12:10pm    
I am using hook and i am writing hotkey for another program its a game
ZiDoM 6-Sep-12 13:54pm    
Any other ideas i cant solve it myself

You could specify a conversion table like this:

char temp = readkey();
char result;
if (temp == "k") result = q;
Share this answer
ZiDoM 5-Sep-12 6:45am    
this doesnt work in win32
You can hook into Windows Message Queue check for WM_KEYXYZ and manipulate the message.

It makes no big sense to do something like this but it is possible ;)

Share this answer
ZiDoM 5-Sep-12 6:53am    
sry but i am not such pro can you give me example
[no name] 5-Sep-12 6:58am    
What kind of environment are you using? Visual Studio, Embarcadero?
ZiDoM 5-Sep-12 7:35am    
Visual Studio
Use Replace method.

Console.Write(Console.ReadLine().Replace('k', 'q'));
Share this answer
ZiDoM 5-Sep-12 6:57am    
i am programming in win32
[no name] 5-Sep-12 7:01am    
You should tag it!
[no name] 5-Sep-12 7:05am    
Cool down ;) At least he mentioned it in his question....
ZiDoM 5-Sep-12 7:05am    
i said that in my question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900