tags:

views:

1546

answers:

4

I am developing a software that needs to know when the PASTE EVENT (through the context menu or ctrl+V) happens (only for files / directories). More or less, something like it happens with TeraCopy or Copy Handler. When you copy and then paste, it is TeraCopy thats handles the pastings.
I know more or less how to capture the COPY EVENT, you only have to set a ClipboardViewer and you catch all global COPY EVENTS (in fact is called: WM_DRAWCLIPBOARD). You can learn this here: http://www.radsoftware.com.au/articles/clipboardmonitor.aspx But the ClipBoardViewer does not provide you with the ability to catch the PASTE EVENT.

+1  A: 

The process of state change via "Pasting" is specific to individual applications, as such there is no magic way to discover whether the state of an application changed after accessing the clipboard.

The best you can do is detect whether an application has retrieved data from the clipboard. Again, there's no way of knowing what the application did with this data. It's akin to knowing someone opened their frontdoor without knowing where they went, if anywhere.

If you do want to try this you could do something like hooking the GetClipboardData function. For information about how to palce system-wide API hooks check out the samples in Micrsoft Detours - http://research.microsoft.com/sn/detours

Andrew Grant
A: 

But software like Teracopy and Copy Handler detect the paste event. I need almost the same, detect when a file / directory is pasted.

netadictos
A: 

Could it be that they just detect the keypress ctrl+v instead?

mmiika
A: 

In fact, this software does not only work for ctrl+v, but also when you click on the option of paste in the context menu (right click).

netadictos