change ascii character to extended ascii character system wide

Sir i need to develop a software where i have to change the ascii character into extended ascii character and send to the active application.

say if a user type A from the keyboard it should be converted to say € irrespective of whatever the application is running may be it is visual studio or word or notepad or photshop u name it.

i need the codings of intercepting that message and load that message with extended ascii character(system wide and not for any single application)

thanks in advance

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This has got what you are looking for:
vimalpercyAuthor Commented:
Thank you Mr Rstavely
       Using this keyboard hook i just can get the keystrokes but what my requirement is to change that keystroke to extended ascii character and the application which is in focus should get the changed extended ascii character.

Thanks in advance
With reference to...

.... I've not played with this, but you might find it best to hook WH_KEYBOARD, trap and remove the WM_KEYUP and WM_KEYDOWN messages for the key you want to substitute and then to PostMessage WM_KEYUP and WM_KEYDOWN messages for the key you want it substituted with.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: rstaveley {http:#9730793}

Please leave any comments here within the next four days.

EE Cleanup Volunteer
vimalpercyAuthor Commented:
Hello mr rstaveley

  I tried the method which you have suggested long back but still the main problem is sending an extended ascii character using postmessage(wmKeydown,wmkeykup) messages.\

I can able to send normal ascii characters using postmessage but how about extended ones like õ

I was able to do with postmessge(Wmchar)
but it works differently for different applications.

so dont know what to do..

If you are very sure in helping me in this than we will continue with this question else i close the question for refund.

Thank you very much mate
with regards
Bit 24 in the LPARAM of the WM_KEYUP/WM_KEYDOWN message tells you that the key is an extended one. The WPARAM only gives you the virtual key code.


By all means close the question for a refund. Sorry I cannot be more helpful.
vimalpercyAuthor Commented:
Thank you very much mr rstaveley
i tried as you have told but still the character send by that way not printing in the application

scanCode = VkKeyScan(õ);
SParam = (scanCode << 16) + 1;
PostMessage(msg->hwnd, WM_KEYDOWN, õ, SParam);
PostMessage(msg->hwnd, WM_UP, õ, SParam);

what am i doing wrong.

I just need this requirement

say if you type a   ,, by some means remove 'a' and put three extended ascii characters

so what i tried is send (backspace, 3 extended ascii characters) but they are not printing in the applicaiton ,
but if i send normal ascii characters they are printing in the application

please help me in this one

thanks in advance
with regards
It may be that you need to discard the key and use SendInput to send the unicode key. Try hacking the following and replacing the 'a','b','c' to the unicode character(s) you want to send to see if it is acceptable to your application. You should toggle to your application during the sleep, when this executes. If this works, you could trap the key which you want to substitute, set the focus to your application [presumably unnecessary!] and then use SendInput as illustrated to push unicode.

// Compile and link:
// cl /EHsc sendinput.cpp user32.lib

#define      _WIN32_WINNT      0x0500 // Needs Windows 2000 or better
#define      _WINVER            0x0500

#include <windows.h>
#include <vector>

void add_press_and_release(const std::wstring str,std::vector<INPUT>& v);
void add_press_and_release(wchar_t c,std::vector<INPUT>& v);

int main()
      std::vector<INPUT> v;

      Sleep(2000); // During this sleep toggle to your application


void add_press_and_release(const std::wstring str,std::vector<INPUT>& v)
      for (std::wstring::const_iterator itr = str.begin();itr != str.end();++itr)

void add_press_and_release(wchar_t c,std::vector<INPUT>& v)
      INPUT event;
      event.type = INPUT_KEYBOARD; = 0;      // Using unicode = 0;      // Use system timestamp = GetMessageExtraInfo(); = c;      // Unicode character to be sent to the foreground application = KEYEVENTF_UNICODE; // KEYDOWN
      v.push_back(event); = KEYEVENTF_KEYUP | KEYEVENTF_UNICODE; // KEYUP

This is my best shot. Hope it helps.
This certainly works at the cmd.exe prompt with....

       add_press_and_release(L"echo à bientôt!\r",v);
The wchar_t and wstring isn't necessary for characters 128..255, but it would be necessary for characters > 255.
vimalpercyAuthor Commented:
Hello mr  rstaveley

  THank you very much for your help. I am working on your code.
But since my application is a system level hook and have to run on 98 also i cant go for unicode .
But anyway if i can first make a application which work in atleast 2000 then i can build from there , ]
Still i am trying out your codings
I come up with answer or question after working on that one

Thanks and regards
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.