Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. copy selected text to my application

copy selected text to my application

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pma
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • P pma

      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

      J Offline
      J Offline
      jan larsen
      wrote on last edited by
      #2

      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

      P 1 Reply Last reply
      0
      • J jan larsen

        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

        P Offline
        P Offline
        pma
        wrote on last edited by
        #3

        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.

        J 1 Reply Last reply
        0
        • P pma

          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.

          J Offline
          J Offline
          jan larsen
          wrote on last edited by
          #4

          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

          P 1 Reply Last reply
          0
          • J jan larsen

            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

            P Offline
            P Offline
            pma
            wrote on last edited by
            #5

            its bad, and its something I've already tried, its working with Notepad and some other applications, but not with Excel, lets sys generaly:(( Maybe some others have already solved such a thing in the past and can help us out here. Thank you anyway

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups