在线等:调试过程中出现这样的错误提示,是什么原因?关于TMemoryStream和TJpegImage的(200分)

  • 主题发起人 主题发起人 nywjx
  • 开始时间 开始时间
N

nywjx

Unregistered / Unconfirmed
GUEST, unregistred user!
首先出现提示:
project Capture.exe raised exception class EOutOfResources with message 'Out of system resources'.Process stopped.Use Step or Run to continue.
点击'OK'后出现下面的提示:
project F:/V1.2/Capture.exe faulted with message:'application-defined exception(code 0x0eedfade) at 0x77e8b2f0'.process stopped.use step or run to continue.
点击'OK'后又出现下面的提示:
project F:/V1.2/Capture.exe faulted with message:'privileged instruction at 0x0230f8c8'.process stopped.use step or run to continue.
再按'OK'后就一直出现最后一个提示了。
到底是什么方面的错误呢?急死了。
 
EOutOfResources is raised when an application attempts to create a Windows or widget handle and there are no more handles to allocate.

沒有句柄可分配了。
應該把代碼貼出來看看
 
就是下面这个过程中出错,我用的CG300的图像采集卡,首先采集到bmp文件,然后得到jpeg文件,存放至数据库中。
CG300API.CG300SetADParam(hcg, AD_SOURCE, 1);
sleep(DelayTime);
TempStream := TMemoryStream.Create;
CG300CaptureToMem(hcg, PhysMemAdrr, BlockSize*4096, 0, FRAME, 1);
CG300ReadFromMem(hcg, Pchar(LineAddr), BlockSize*4096, 0, ppBuf);
BMIInfo.bmiHeader.biSize := Sizeof(BITMAPINFOHEADER);
BMIInfo.bmiHeader.biWidth:=400;
BMIInfo.bmiHeader.biHeight:=300;
BMIInfo.bmiHeader.biPlanes:=1;
BMIInfo.bmiHeader.biBitCount:=24;
BMIInfo.bmiHeader.biCompression:=BI_RGB;
BMIInfo.bmiHeader.biSizeImage:=0;
BMIInfo.bmiHeader.biXPelsPerMeter:=0;
BMIInfo.bmiHeader.biYPelsPerMeter:=0;
BMIInfo.bmiHeader.biClrUsed:=0;
BMIInfo.bmiHeader.biClrImportant:=0;
SetDibitsToDevice(TempBmp.Canvas.Handle, 0, 0, 400, 300, 0, 0, 0, 300, ppBuf,
BMIInfo, DIB_RGB_COLORS) ;
TempJPEG.Assign(TempBmp);
TempJpeg.SaveToStream(TempStream);
FileName:=TimeToStr(Time);
repeat
position:=Pos(':',FileName);
if position<>0 then Delete(FileName,position,1);
until position=0;
FileName:=ExtractFilePath(Application.EXEName)+FileName+'.Jpg';
TempStream.SaveToFile(FileName);
TempStream.Free;

if InOrOut='ImageIn' then
with ADOQueryUp do
try
Close;
Sql.Clear;
Sql.Add('update 库内车辆表 set 入库车辆照片=:FileSource where 卡号=:CardNo');
Parameters[0].LoadFromFile(FileName,ftBlob);
Parameters[1].Value:=UpdateCardNo;
ExecSQL;
except
end
else
if InOrOut='ImageOut' then
begin
if IfRtn='1' then
begin
with ADOQueryUp do
begin
try
Close;
Sql.Clear;
Sql.Add('update 库内车辆表 set 出库车辆照片=:FileSource where 卡号=:CardNo');
Parameters[0].LoadFromFile(FileName,ftBlob);
Parameters[1].Value:=UpdateCardNo;
ExecSQL;
except
end;
NMUDP1.ReportLevel := Status_Basic;
NMUDP1.RemoteHost:=SerIP;
TmpStr:='Image'+'@'+IntToStr(UpdateCardNo)+'@'+IntToStr(ImagePort)+'@'+IntToStr(CardType)+'@'+OutIP;
MyStream := TMemoryStream.Create;
try
MyStream.Write(TmpStr[1], Length(TmpStr));
NMUDP1.SendStream(MyStream);
finally
MyStream.Free;
end;
end;
end
else
if CardType=1 then
with ADOQueryUp do
try
Close;
Sql.Clear;
Sql.Add('update 历史记录表 set 出库车辆照片=:FileSource where 卡号=:CardNo and 入库时间='+''''+InDT+'''');
Parameters[0].LoadFromFile(FileName,ftBlob);
Parameters[1].Value:=UpdateCardNo;
ExecSQL;
except
end;
end;
try
DeleteFile(FileName);
except
end;
 
后退
顶部