为什么位图像素数据的字节数biSizeImage求出为0
nhcf 2001-08-03 04:56:39 CFileDialog opendialog(true,NULL, NULL,OFN_HIDEREADONLY ,"bmp file(*.bmp)|*.bmp|jpeg file(*.jpg)|*.jpg|All Files (*.*)|*.*||",
this);
HANDLE hfile;
BITMAPINFOHEADER bih;
BITMAPFILEHEADER bfh;
DWORD dwread;
LPCTSTR lpstr;
CString filename;CString str;
if(opendialog.DoModal()==IDOK)
{
filename=opendialog.GetPathName();//full cstring object include path and filename;
lpstr=LPCTSTR(filename);
if((hfile=CreateFile(lpstr,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN,NULL))!=NULL)
{
ReadFile(hfile,&bfh,sizeof(BITMAPFILEHEADER),&dwread,NULL);
ReadFile(hfile,&bih,sizeof(BITMAPINFOHEADER),&dwread,NULL); // is ok also;
str.Format("%d and %x and %d",bih.biSizeImage,bfh.bfType,bfh.bfSize);
AfxMessageBox(str,MB_OK,0);
}