Hi,
I want to have this feature in my C# program: When the user do Ctrl+C or Copy anywhere (i.e. when the clipboard content changes), my program will get notified, and check whether the content met certain criteria, if so, become the active program, and process the content, etc.
I can get the contents out from System.Windows.Forms.Clipboard
, however, I don't know how to monitor the content changes from the Clipboard.
Cheers,
EDIT: If using Vista or later, use AddClipboardFormatListener
as in John Knoeller's answer, for XP, have to use the older, more fragile SetClipboardViewer
API, as in the accepted answer.