Click here to Skip to main content
15,904,494 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I need to detect every paste operation in windows(whether it's done by using ctrl+V or right-click and paste or ...). I am using Embarcadero c++ builder(non-MFC). Whenever the user copies a folder or a file and then pastes it, I have to get the address of the copied file.Can anybody give me a hint?

Thanks.
Posted
Updated 18-Nov-11 21:37pm
v2
Comments
Mohibur Rashid 19-Nov-11 6:52am    
hooking keyboard action and mouse action might help
lilyNaz 20-Nov-11 4:13am    
Well, Is it possible to hook copyfile instead of hooking keyboard and mouse actions?
Code-o-mat 21-Nov-11 4:56am    
Read this: http://www.codeproject.com/KB/system/hooksys.aspx about API Hooking. Of course, if you hook CopyFile or somesuch, that will be also invoked in other situations, not just when the user copy-paste a file/folder. Maybe you could try (also) hooking GetClipboardData, but this again, will most likely be invoked in other situations.
Pedramphhi 8-Jun-12 16:50pm    
you beter dont use hook directly but
you can use a timer in your app as an idle loop then
inside of the loop using following code
use GetKeyState function to detect when both of Ctrl+C are down (for copy) then
use Clipboard Function like GetClipboardData to get last "copy from" address then
use GetKeyState function to detect when both of Ctrl+V are down (for copy) then
use GetCursorPos function to detect where is mouse now and finf target

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900