BITMAPFILEHEADER bmfh; ZeroMemory(&bmfh, sizeof(BITMAPFILEHEADER)); bmfh.bfType = *(WORD*)"BM"; bmfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bmih->biSizeImage; bmfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); FILE* fp = fopen("C:\\MyWorks\\tmp1.bmp", "wb"); if(fp != NULL) { fwrite(&bmfh, 1, sizeof(BITMAPFILEHEADER), fp); fwrite(bmih, 1, sizeof(BITMAPINFOHEADER), fp); fwrite(lpBits, 1, bmih->biSizeImage, fp); fclose(fp); }