I have a windows application running at the backend. I have functions in this applications mapped to hot keys. Like if I put a message box into this function and give hot key as Alt+Ctrl+D. then on pressing Alt, Ctrl and D together the message box comes up. My application is working fine till this point.
Now I want to write a code inside this function so that when I am using another application like notepad, I select a particular line of text and press the hot key Alt + Ctrl + D it is supposed to copy the selected text append it with ‘_copied’ and paste it back to notepad.
Anyone who has tried a similar application please help me with your valuable inputs.
Your question has two answers
How can my app set a global hotkey
You have to call an API funcion called RegisterHotKey
More info here: http://www.codeproject.com/KB/system/nishhotkeys01.aspx
How to get the selected text from the foreground window
Easiest way is to send crl-C to the window and then capture the clipboard content.
Disclaimer: Code by Marcus Peters from here: http://bytes.com/forum/post1029553-5.html
Posted here for your convenience.