Writing Clipboard To File
Hi all, ran into a little trouble.
I'm trying to write a bitmap from the clipboard to a file, but I can't seem to be able to. I've tried a few different methods and doing some google searches has led me this far, but I can't seem to be able to get the bitmap data from the clipboard...
Any help?? Thanks
FILE *pFile = fopen("test.bmp", "wb");
int nBitsOffset = sizeof(BITMAPFILEHEADER) + BMIH.biSize;
LONG lImageSize = BMIH.biSizeImage;
LONG lFileSize = nBitsOffset + lImageSize;
bmfh.bfType = 'B'+('M'<<8);
bmfh.bfOffBits = nBitsOffset;
bmfh.bfSize = lFileSize;
bmfh.bfReserved1 = bmfh.bfReserved2 = 0;
UINT nWrittenFileHeaderSize = fwrite(&bmfh, 1, sizeof(BITMAPFILEHEADER), pFile); //Write the bitmap file header
UINT nWrittenInfoHeaderSize = fwrite(&BMIH, 1, sizeof(BITMAPINFOHEADER), pFile); //And then the bitmap info header
UINT nWrittenDIBDataSize = fwrite(bitmapData, 1, lImageSize, pFile); //Finally, write the image data itself