How to hook copy actions in windows
I know how to write and use windows hook DLLs to capture things such as window messages on a window. What I need to do is capture any copy (Control+C or other method) done on the system in any application. Is there a quick simple way to do th开发者_开发知识库is using windows hooks?
You're looking for the SetClipboardViewer function.
Anytime the clipboard contents change, the most recent window to have been registered via this function (or the related ChangeClipboardChain) will receive a WM_DRAWCLIPBOARD message.
Its an applications responsibility to pass the message down the chain for to other registered viewers, as well as to un-register itself during shutdown.
This will be much more reliable than trying to hook ctrl+c.
精彩评论