views:

373

answers:

3

This is a bit of a long shot, but if anyone can figure it out, you guys can...

In Windows XP, is there any meta-data that comes with a cut and paste action, from which I can ascertain the application that provided the clipboard contents?

Bonus question... if there is such information, is there any way I can access it through a Java app?

Thank you!

+1  A: 

That depends on the clipboard format. If it is plain-text, then no. Unless you want to install global hooks on the clipboard.

Which you cannot do from Java.

Stu
+1  A: 

The API function GetClipboardOwner returns the clipboard owner (http://msdn.microsoft.com/en-us/library/ms649041(VS.85).aspx), -sorry cannot mark as link because the "()" in the URL-

Don't know Java, I suppose you can call native API functions from inside the Java VM.

A "quick and dirty" approach could be using an AutoHotKey script to intercept the CTRL+C / CTRL+INS hotkeys, grab the id of the active process (in a file or any place that can be accessed by the Java app) and proceed with the clipboard copy. The AutoHotKey part shouldn't be difficult, don't know about the Java part.

PabloG