Given the same content in the system clipboard, I run the following snippets:
For C++:
if (OpenClipboard(NULL)) {
for (int i = 0;;) {
i = EnumClipboardFormats(i);
if (i == 0)
break;
GetClipboardFormatName(i, buf, sizeof(buf)/sizeof(buf[0]));
printf("%+09d\t%s\n", i, buf);
}
CloseClipboard();
}
For Java (in an Applet):
Toolkit toolkit = Toolkit.getDefaultToolkit();
Clipboard clipboard = toolkit.getSystemClipboard();
for (DataFlavor df : clipboard.getAvailableDataFlavors()) {
System.out.println(df.getHumanPresentableName() + " " + df.getMimeType());
}
Surprisingly for me, the two return different number of available formats, and those that I get are apparently also different, e.g. a certain custom data format is interpreted as an x-java-image in Java, even though it's definitely not a picture of any kind.
Does anyone know why this is or how I can adjust this behavior? Basically I would like to access data in custom formats through clipboard in Java, but it doesn't seem to work straight away.
UPD: Here is a sample output the two snippets give for the custom data format in question:
C++
+00049654 MDLSK
+00049156 Native
+00049155 OwnerLink
+00000003 OwnerLink
+00000014 OwnerLink
Java
image/x-java-image image/x-java-image; class=java.awt.Image