Jump to content
  • Advertisement
Sign in to follow this  
Instigator

Modifying Keyboard... Win XP

This topic is 4239 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using windows xp service pack 2 and I'd like to know if any of you know of a way to make it so that whenever I press a keyboard combo like "alt-p" it would produce and paste a symbol for me like "->". This would be extremely useful in c++ where I'm constantly typing "->". Does win xp have this feature built in? Or what the best way to do this?

Share this post


Link to post
Share on other sites
Advertisement
Create a background application that does:
1. Register a global hotkey with key combination of your choise and
2. Handles WM_HOTKEY message and injects synthetic input using keybd_event API

RegisterHotKey
keybd_event

I guess that should be it. Although for such a small strings as "->" I doubt it will offer any advantage over manual typing...

EDIT: Note that this method is just a hack as you can only inject keystrokes via keybd_event. Still it should work for ASCII quite painlessly.

Share this post


Link to post
Share on other sites
You may want to look into one of the Intellisense addons available on the web. May I recommend VisualAssist X?. This doesn't much help in developing good habits but, among many other irreplacable features, it will replace '.' with '->' (as you type) whenever the cursor is to the right of a pointer. I almost never find myself typing '->' any more. I'm sure this will come back to haunt me at some point in the future.
But combined with improved syntax highlighting, code completion and enhanced navigation, I'd never go back. </advertisment>

Regards
Admiral

Share this post


Link to post
Share on other sites
More Visual Assist p1mpage: I couldn't live without it - I consider it an absolutely essential addition to Visual Studio.

As for disclosure: I have no connection with the tomato guys, except as a customer.

Share this post


Link to post
Share on other sites
This should work if you just want what you said:


#include <windows.h>
#include <winable.h>
int main() {
while(true) {
if( ::GetAsyncKeyState(VK_MENU) && ::GetAsyncKeyState(0x50) ) {
INPUT* input = new INPUT[ 4 ];
::ZeroMemory( input, 4*sizeof(INPUT) );
input[ 0 ].type = input[ 1 ].type = input[ 2 ].type = input[ 3 ].type = INPUT_KEYBOARD;
input[ 0 ].ki.wVk = VkKeyScan( '-' );
input[ 1 ].ki.dwFlags = KEYEVENTF_KEYUP;
input[ 2 ].ki.wVk = VkKeyScan( '>' );
input[ 3 ].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(4, input, sizeof(INPUT));
Sleep(500);
}
Sleep(0);
}
}



You can add some sort of a kill condition too, so you wouldn't have to use CTRL+ALT+DELETE to exit [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!