/* The original version of this program can be found at http://damb.dk */
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
int main(void)
{
char *s;
HANDLE handle;
if(!OpenClipboard(NULL))
{
printf("Failed to open clipboard!n");
return EXIT_FAILURE;
}
if((handle = GetClipboardData(CF_TEXT)) == 0)
{
printf("Failed to get clipboard data!n");
CloseClipboard();
return EXIT_FAILURE;
}
if((s = (char *)GlobalLock(handle)) == NULL)
{
printf("Failed to lock clipboard data!n");
CloseClipboard();
return EXIT_FAILURE;
}
printf("Clipboard data: %sn", s);
CloseClipboard();
return 0;
}