Ver Mensaje Individual
  #4  
Antiguo 17-10-2006
Avatar de lag_0
lag_0 lag_0 is offline
Miembro
 
Registrado: jul 2006
Posts: 131
Reputación: 18
lag_0 Va por buen camino
sigue pasando

Pues ahora hago que el buffer que se llenaba (un TStrings), de todas maneras no podia ser por eso ya que haciendo el mismo bucle sin el proceso de las capturas no da error por más veces que lo repite.

pongo el codigo que al repetirse demasiado da el error
:
Código Delphi [-]
procedure TForm17.identificaTimer(Sender: TObject);
Var DeskHw,DeskHdC : Longint;
begin
 identifica.Enabled:=false;
 DeskHw:=getdesktopwindow;
 DeskHdc:=getdc(deskHw);
 cap.Picture.Bitmap:=nil;
 cap.height:=ff.autoini.ReadInteger('Ventana','AlOk',0);
 cap.width:=ff.autoini.ReadInteger('Ventana','AnOk',0);
 BitBlt(cap.Canvas.Handle,0,0,ff.autoini.ReadInteger('Ventana','AnOk',0),ff.autoini.ReadInteger('Vent  ana','AlOk',0),DeskHdc,ff.autoini.ReadInteger('Ventana','LeftOk',0),ff.autoini.ReadInteger('Ventana'  ,'TopOk',0),SRCCOPY);
 //cap.Repaint;
 //sleep(1000);
   guardada.Picture.Bitmap:=nil;
   guardada.Width:=cap.Width;
   guardada.Height:=cap.Height;
   guardada.Picture.Bitmap.LoadFromFile(ff.Appdir+'Perfiles\'+ff.CasinoPerfil+'\Tirada Ok.bmp');
   guardada.Repaint;
 if not soniguales() then begin
    guardada.Picture.Bitmap:=nil;
   guardada.Width:=cap.Width;
   guardada.Height:=cap.Height;
   guardada.Picture.Bitmap.LoadFromFile(ff.Appdir+'Perfiles\'+ff.CasinoPerfil+'\Tirada Ok1.bmp');
   guardada.Repaint;
 if soniguales() then begin
  //enxufas el proximo timer
    Form16.ae.Caption:='Resultado obtenido...';
    miranum.enabled:=true;
 end else begin
    Form16.ae.Caption:='Aún no se recibio resultado...';
   identifica.Enabled:=true;
 end;
 end else begin
     Form16.ae.Caption:='Resultado obtenido...';
    miranum.enabled:=true;
 end;
end;

Código Delphi [-]
procedure TForm17.miranumTimer(Sender: TObject);
var
 num:integer;
 i:integer;
 DeskHw,DeskHdC : Longint;
begin
  miranum.Enabled:=False;
  cap.Picture.Bitmap:=nil;
 DeskHw:=getdesktopwindow;
 DeskHdc:=getdc(deskHw);
 cap.height:=ff.autoini.ReadInteger('Ventana','AlNum',0);
 cap.width:=ff.autoini.ReadInteger('Ventana','AnNum',0);
 BitBlt(cap.Canvas.Handle,0,0,ff.autoini.ReadInteger('Ventana','AnNum',0),ff.autoini.ReadInteger('Ven  tana','AlNum',0),DeskHdc,ff.autoini.ReadInteger('Ventana','LeftNum',0),ff.autoini.ReadInteger('Venta  na','TopNum',0),SRCCOPY);
 //cap.Repaint;
 i:=0;
 num:=-1;
 form16.ae.Caption:='Comparando imagen...';
  while i < 37 do begin
     guardada.Picture.Bitmap:=nil;
     guardada.Picture.Bitmap.LoadFromFile(ff.Appdir+'Perfiles\'+ff.CasinoPerfil+'\'+inttostr(i)+'.bmp');
     if soniguales() then begin
      num:=i;
      i:=37;
     end;
     i:=i+1;
  end;
  form16.ae.Caption:='Imagen obtenida: Num. '+inttostr(num);
  if num > -1 then
    ff.AddNum(inttostr(num));
end


Y llega a addnum que por si solo no da ningún error.



Funcion sonIguales(); que utilizan los dos timers...:

Código Delphi [-]
function TForm17.SonIguales():bool;
var
   Cx,CY:integer;
begin
  cx:=0;
  Result:=True;
  while Cx <= cap.Width do begin
   cy:=0;
    while CY <= cap.Height do begin
      if cap.Canvas.Pixels[CX,CY] <> guardada.Canvas.Pixels[CX,CY] then begin
        Result:=false;
        cx:=cap.Width+1;
        cy:=cap.Height+1;
      end;
      cy:=cy+1;
    end;
    cx:=cx+1;
  end;
end;


se os ocurre por que puede darme ese error? no hay buffers grandes ya... no entiendo por que puede ser
Responder Con Cita