WinCE平台下BMP转JPG代码备份3
1 //带参数的保存位图函数 2 BOOL FileOperate::bmpSaveImage(PTSTR pstrFileName, BITMAPFILEHEADER *pbmfh) 3 { 4 BOOL bSuccess ; 5 DWORD dwBytesWritten ; 6 HANDLE hFile; 7 8 hFile = CreateFile ( pstrFileName, GENERIC_WRITE, 0, NULL, 9 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ; 10 11 if (hFile == INVALID_HANDLE_VALUE) { 12 return FALSE ; 13 } 14 15 bSuccess = WriteFile (hFile, pbmfh, pbmfh->bfSize, &dwBytesWritten, NULL); 16 17 CloseHandle (hFile) ; 18 19 if (!bSuccess || (dwBytesWritten != pbmfh->bfSize)) { 20 DeleteFile (pstrFileName) ; 21 return FALSE ; 22 } 23 return TRUE ; 24 } 25 26 //**************