Last active
August 20, 2019 01:58
-
-
Save Phyllostachys/17e9e8b30419b3508e382d5bf7c6f3dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <cstdio> | |
int main() { | |
char buf[1024]; | |
auto ret = OpenClipboard(NULL); | |
if (ret == 0) { | |
printf("%d\n", ret); | |
} | |
printf("Num of formats in clipboard: %d\n", CountClipboardFormats()); | |
for (int i = 0; i < 0xFFFF; i++) { | |
if (IsClipboardFormatAvailable(i)) { | |
int length = GetClipboardFormatNameA(i, buf, 1024); | |
buf[length] = 0; | |
printf("%s (0x%X) is available\n", buf, i); | |
} | |
} | |
puts(""); | |
// RTF - 0xC079 | |
if (IsClipboardFormatAvailable(0xC079)) { | |
void *data = GetClipboardData(0xC079); | |
printf("RTF:\n%s\n\n", (char *)data); | |
} | |
// "HTML Format" - 0xC0BF | |
if (IsClipboardFormatAvailable(0xC0BF)) { | |
void *data = GetClipboardData(0xC0BF); | |
printf("HTML Format:\n%s\n\n", (char *)data); | |
} | |
// text/html - 0xC19E | |
if (IsClipboardFormatAvailable(0xC19E)) { | |
void *data = GetClipboardData(0xC19E); | |
printf("text/html:\n%s\n\n", (char *)data); | |
} | |
if (IsClipboardFormatAvailable(1)) { | |
void *data = GetClipboardData(1); | |
printf("plain text:\n%s\n\n", (char *)data); | |
} | |
CloseClipboard(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment