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. catching CTRL+V

catching CTRL+V

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
3 Posts 3 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.
  • A Offline
    A Offline
    allia
    wrote on last edited by
    #1

    I wrote a little clipboard application and I want that every time a CTRL+V is pressed to perform some action in my application that will affect the data in the clipboard, repost it to the clipboard and display it on the screen. lets say, that I did CTRL+C on "hello" and now pressed CTRL+V. my application will convert to upercase "HELLO" and I want it pasted on screen (of course without the smallercase "hello") I have talked to people who said maybe catching an interrupt of CTRL+V and creating one after manipulation - but, can I make sure my CTRL+V interrupt is done before it is pasted by the OS on the screen ? if so, how do I catch and throw such an interrupt ? :~ thank you in advance, MA.

    R M 2 Replies Last reply
    0
    • A allia

      I wrote a little clipboard application and I want that every time a CTRL+V is pressed to perform some action in my application that will affect the data in the clipboard, repost it to the clipboard and display it on the screen. lets say, that I did CTRL+C on "hello" and now pressed CTRL+V. my application will convert to upercase "HELLO" and I want it pasted on screen (of course without the smallercase "hello") I have talked to people who said maybe catching an interrupt of CTRL+V and creating one after manipulation - but, can I make sure my CTRL+V interrupt is done before it is pasted by the OS on the screen ? if so, how do I catch and throw such an interrupt ? :~ thank you in advance, MA.

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      I don't know a lot about it, but you can use ole classes, first to catch the CTRL+V operation (OnKeyDown ?), and then create a COleDataObject, attach it the Clipboard AttachClipboard retrieve the data from the clipboard GetData. Modify your data, create a COLEDataSource, and use CopyToClipboard. :omg: That'S the first I would try. :-O ~RaGE();

      1 Reply Last reply
      0
      • A allia

        I wrote a little clipboard application and I want that every time a CTRL+V is pressed to perform some action in my application that will affect the data in the clipboard, repost it to the clipboard and display it on the screen. lets say, that I did CTRL+C on "hello" and now pressed CTRL+V. my application will convert to upercase "HELLO" and I want it pasted on screen (of course without the smallercase "hello") I have talked to people who said maybe catching an interrupt of CTRL+V and creating one after manipulation - but, can I make sure my CTRL+V interrupt is done before it is pasted by the OS on the screen ? if so, how do I catch and throw such an interrupt ? :~ thank you in advance, MA.

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        Don't need to talk about interrupt ( Yuck!) in your application, you need to handle the CTRL-V message ; either as an acceleration, which should already be in the accelerator table of the resources, and with the menu entry. the accelerator and menu will have the same ID, for example IDM_EDIT_PASTE, and your code, in the CWnd derived class that you want to receive the message, you will have to add something like ( manually or with the wizard ):

        // in the message map section
        ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
        ...
        void CMainFrame::OnEditPaste()
        {
        // here you do your clipboard operations.
        }

        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