copy selected text to my application
-
Hi, I'd like to copy the selected text of any other application with a system-wide-keyboard-shortcut automaticly to my application. Should be working like in Babylon Translator. Maybe someone can guide me to good starting point, or better has some code that might help me. Thank you Mario
-
Hi, I'd like to copy the selected text of any other application with a system-wide-keyboard-shortcut automaticly to my application. Should be working like in Babylon Translator. Maybe someone can guide me to good starting point, or better has some code that might help me. Thank you Mario
CTRL-C CTRL-V :-) Look at the WinAPI functions like SetClipboardData and OpenClipboard. pma wrote: I'd like to copy the selected text of any other application The 'selected text' have to be in the clipboard, the concept 'selected text' is a feature in certain components, and not something inherent in a window or an application. "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
-
CTRL-C CTRL-V :-) Look at the WinAPI functions like SetClipboardData and OpenClipboard. pma wrote: I'd like to copy the selected text of any other application The 'selected text' have to be in the clipboard, the concept 'selected text' is a feature in certain components, and not something inherent in a window or an application. "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
well thats clear :rolleyes:, I like to copy the text, open my application and paste this text automaticly. And also the other way round: - press a hotkey - my application copy's the text into clipboard - go-back to the window where we came from - paste the text The problem is not to copy/paste to the clipboard. The problem is how to hook the hotkey with my application, then go back to where the user came from and copy the text into the clipboard. After that my program needs the focus again and has to paste the clipboard content into my application.
-
well thats clear :rolleyes:, I like to copy the text, open my application and paste this text automaticly. And also the other way round: - press a hotkey - my application copy's the text into clipboard - go-back to the window where we came from - paste the text The problem is not to copy/paste to the clipboard. The problem is how to hook the hotkey with my application, then go back to where the user came from and copy the text into the clipboard. After that my program needs the focus again and has to paste the clipboard content into my application.
pma wrote: then go back to where the user came from and copy the text into the clipboard. There is no way to do that explicitly, read: nicely. A SWAG would be to somehow trigger a CTRL-C in the window. Hmmm... Using Win32 API you can get the active window, then you could send a keypressed message containing CTRL-C, and, hopefully, it would have triggered the app to copy something to the clipboard. Not Quick, but definately Dirty, and one out of two ain't bad :-D "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
-
pma wrote: then go back to where the user came from and copy the text into the clipboard. There is no way to do that explicitly, read: nicely. A SWAG would be to somehow trigger a CTRL-C in the window. Hmmm... Using Win32 API you can get the active window, then you could send a keypressed message containing CTRL-C, and, hopefully, it would have triggered the app to copy something to the clipboard. Not Quick, but definately Dirty, and one out of two ain't bad :-D "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus