catching CTRL+V
-
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.
-
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.
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 aCOleDataObject
, attach it the ClipboardAttachClipboard
retrieve the data from the clipboardGetData
. Modify your data, create aCOLEDataSource
, and useCopyToClipboard
. :omg: That'S the first I would try. :-O ~RaGE(); -
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.
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.
}