Ultimately I want to save the Image from the clipboard to an img file(.bmp, JPEG whatever). That's a long road, so I just want to load the image into the window but I don't seem to have any succes with GetClipboardData(). It always returns NULL. Searching has not helped me.. Code to get the HBITMAP from the clipboard:
HWND hwnd = FindWindow("ConsoleWindowClass", NULL);
if(!OpenClipboard(hwnd)) printf("Error opening clipboard\n");
HBITMAP hbmp;
EmptyClipboard();
Sleep(3000);
if((hbmp = (HBITMAP)GetClipboardData(CF_BITMAP)) == NULL) printf("Error geting clipboard data\n");
Output: Error getting clipboard data
I tried using GetLastError() with formatting and everything, and it says file not found. The sleep is to wait for me to press print screen, to be sure the clipboard has some data.