J
JobsLee
Unregistered / Unconfirmed
GUEST, unregistred user!
Var
tmpStream:TFileStream;
FileHeader:TBitMapFileHeader;
FbmHeadInfo: PBITMAPINFOHEADER;
begin
TmpStream:=TFileStream.Create('FileName',fmOpenRead);
try
TmpStream.ReadBuffer(FileHeader,Sizeof(TBITMAPFILEHEADER));
if FileHeader.bfType<>$4D42 then raise Exception.Create('无效的位图文件');
GetMem(FbmHeadInfo,Sizeof(TBITMAPINFOHEADER));
TmpStream.ReadBuffer(FbmHeadInfo^,Sizeof(TBITMAPINFOHEADER)) ;
FreeMem(FbmHeadInfo,Sizeof(TBITMAPINFOHEADER));
ShowMessage('X PixelPerMeter:'+IntToStr(FbmHeadInfo.biXPelsPerMeter)
+'X PixelPerMeter:'+IntToStr(FbmHeadInfo.biYPelsPerMeter));
except
TmpStream.Free ;
raise ;
end ;
TmpStream.Free ;
end;