我写的一个一个过程运行是出现“Acess violation at adress 74800BEF in module "msvcrt.dll",
Read of adress 68C6F387”,这是出了什么问题
Read of adress 68C6F387”,这是出了什么问题
解决方案 »
- directoryoutline和filelistbox如何关联?
- Directory is controlled by other .NET file.
- 如何写程序注册一个ocx或者dll呢?
- 怎么将fastreport做的表从数据库中存取,
- 怎样在代码中打开指定的文件,有同源代码在一目录下与不在同一目录下两种!!!
- 如何控制TShockwaveFlash缩放???
- 使用RainXP的XPForm后,若加个menu1后,菜单跑到最顶方,标题跑到菜单下,不知该怎么解决?
- 请大家推荐几个学习大型数据库的中文网站
- 以前用VB,刚刚转入Delphi,不知道API函数在Delphi中如何声明使用,VB中光声明就要写一堆,Delphi呢?烦请举个例:GetComputerName
- 为什么我查询数据库总返回同一条记录?
- 小问题,急盼回答.
- 欲选中硬盘上的某个文件,把它拖到TListView控件中,如何实现?在线等!!
//procedure BmpToAvi(FileDir: string;Filedest:string);
var
Sr:TSearchRec;
FileAtr:integer;
str:string;
bFind:Integer;
nFrames:integer;
hr:HRESULT;
tmp_buf:array of byte; fp:hFile;
StreamInfo:TAVISTREAMINFO;
pFile:IAVIFILE;
ps:IAVISTREAM;
bmpFileHeader:BITMAPFILEHEADER;
bmpInfoHeader:BITMAPINFOHEADER;
begin
nFrames:=0;
str:=FileDir+'*.*';
AVIFileInit();
bFind:=FindFirst(str,faAnyFile,sr);
while (bFind=0) do
begin
bFind:=FindNext(Sr);
if (Sr.Name[1]<>'.') and (sr.Attr<>faDirectory) then
begin str:=ExpandFileName(Sr.Name);
//fp:=_lopen(pChar(str),OF_READWRITE);
fp:=FileOpen(str,fmOpenWrite); //_llseek(fp,0,FILE_BEGIN);
FileSeek(fp,0,0);
//_lread(fp,@bmpFileHeader,sizeof(bmpFileHeader));
FileRead(fp,bmpFileHeader,sizeof(bmpFileHeader));
//_lread(fp,@bmpInfoHeader,sizeof(BITMAPINFOHEADER));
FileRead(fp,bmpInfoHeader,sizeof(BITMAPINFOHEADER));// tmp_buf:= nil; if (nFrames=0) then
begin
AVIFileOpen(pFile,PChar(Filedest),OF_WRITE or OF_CREATE,nil);
FillMemory(@StreamInfo,sizeof(StreamInfo),0);
StreamInfo.fccType:=streamtypeVIDEO;
StreamInfo.fccHandler := 0;
StreamInfo.dwScale := 1;
StreamInfo.dwRate := 15; // 15 fps
StreamInfo.dwSuggestedBufferSize := bmpInfoHeader.biSizeImage ;
SetRect(StreamInfo.rcFrame, 0, 0, bmpInfoHeader.biWidth, bmpInfoHeader.biHeight);
hr := AVIFileCreateStream(pFile,ps,StreamInfo);
end;// getmem(tmp_buf,bmpInfoHeader.biWidth * bmpInfoHeader.biHeight * 3); //_lread(fp,tmp_buf,bmpInfoHeader.biWidth * bmpInfoHeader.biHeight * 3);
FileRead(fp,tmp_buf,bmpInfoHeader.biWidth * bmpInfoHeader.biHeight * 3);
hr := AVIStreamSetFormat(ps,nFrames,@bmpInfoHeader,sizeof(bmpInfoHeader)); hr := AVIStreamWrite(ps, // stream
nFrames , // time of this frame
1, // number to write
tmp_buf,
bmpInfoHeader.biSizeImage , // size of this frame
AVIIF_KEYFRAME, // flags....
Nil,
Nil);
label1.Caption:=inttostr(nFrames);
nFrames:=nFrames+1;
//_lclose(fp);
FileClose(fp);
// freemem(tmp_buf);
end;
end; showmessage(inttostr(5)); if (ps<>nil) then
begin
AVIStreamClose(ps); showmessage(inttostr(6));
end; if (pfile <> nil) then
begin
AVIFileRelease(pfile); showmessage(inttostr(7));
end; AVIFileExit(); showmessage(inttostr(8));
end;
我写的是一个将一组BMP图片合成avi的过程,运行到hr := AVIStreamWrite(ps, // stream
nFrames , // time of this frame
1, // number to write
tmp_buf,
bmpInfoHeader.biSizeImage , // size of this frame
AVIIF_KEYFRAME, // flags....
Nil,
Nil);
时就会出现上述错误。
加上getmem(tmp_buf,bmpInfoHeader.biWidth * bmpInfoHeader.biHeight * 3);运行到这一句时会出现"out of memeory".
开始用_lopen一类的API函数到是可以合成AVI,但是退出过程是报错,有时甚至死机。