Ver Mensaje Individual
  #1  
Antiguo 06-02-2013
novato_erick novato_erick is offline
Miembro
 
Registrado: ago 2010
Ubicación: Panamá
Posts: 396
Reputación: 14
novato_erick Va por buen camino
error en ejecuciones constante en aplicacion...

Hola chicos como estan?

Quiero hacer una consulta tengo un pequeño problema ya que stoy realizando una aplicacion el cual necesito que me mande tres sonidos diferente a la hora de confirmar por ejemplo una marcación.


Ya logre eso sin embargo haciendo prueba note que al ser la segunda o tercera marcación seguida me cierra el programa mandandome el tipico error de windows "aplicacion.exe ah detectado un problema y debe cerrarse" cuando un programa es interrumpido.

pueda ser liberacion de memoria inadecuadamente bueno la verdad no se pero me gustaria que me pudieran ayudar...

envio este codigo para que vean que hago...

Código Delphi [-]
function cargarFicheroMemoria (const fichero : TFileName): string;
begin
  with TFileStream.Create(fichero,
      fmOpenRead or fmShareDenyWrite) do
  begin
    try
      SetLength(Result, Size);
      Read(Pointer(Result)^, Size);
    except
      Result := '';
    Free;
      raise;
    end;
    Free;
  end;
end;

procedure sonidoconfirma;
var
  ficheroSonido : string;

begin
  //cargar fichero en memoria
  case Sonido of

  1: ficheroSonido := cargarFicheroMemoria ('C:\EDD TXT TECNOLOGIA MARCACION\voces\confirmacion.wav');
  2: ficheroSonido := cargarFicheroMemoria ('C:\EDD TXT TECNOLOGIA MARCACION\voces\confirmacionHombre.wav');
  3: ficheroSonido := cargarFicheroMemoria ('C:\EDD TXT TECNOLOGIA MARCACION\voces\noencontrado.wav');
  //reproducir fichero
   end;

  sndPlaySound(Pointer(ficheroSonido), SND_MEMORY
      Or SND_NODEFAULT Or SND_ASYNC);
 ficheroSonido := '';
  sonido:= 0;
  end;

procedure TfrmAsistencia.AgregaAsistencia; 
begin
  dmStoreProcedure.spConsultaCedula.Params.ParamByName('CEDULA').AsString :=
    edtCedula.Text;
  dmStoreProcedure.spConsultaCedula.ExecProc;
  Id_emplAsis := dmStoreProcedure.spConsultaCedula.Params.ParamByName('ID')
    .AsInteger;
  if Id_emplAsis >= 1 then
        begin
            with dmConectar.qMarcaciones do
              begin
                ParamByName('pID_EMPLEADOS').AsInteger := Id_emplAsis;
                execsql;
                    with dmConectar.qConsultaEmpl do
                      begin
                      close;
                        ParamByName('pIDEMPL').AsInteger := Id_emplAsis;
                        execsql;
                      end;
                        dmConectar.qConsultaEmpl.Open;
                        lblCedula.Caption := dmConectar.qConsultaEmplCEDULA_EMPL.AsString;
                        lblNombre.Caption := dmConectar.qConsultaEmplNOMBRE_EMPL.AsString;
                        IFoto.Picture.LoadFromFile(dmConectar.qConsultaEmplIMAGEN_EMPL.AsString);
                          begin
                            if dmconectar.qConsultaEmplID_GENERO.asinteger = 2 then
                            begin
                            sonido:= 2;
                            sonidoconfirma;
                            end
                              else
                              begin
                               sonido:=1;
                             sonidoconfirma;
                              end;
                          end;
             end;
        end
            else
              begin
              sonido:= 3;
              sonidoconfirma;
  end;
end


//Procedimiento que utilizo con timer para que me cambie la foto despues de haber mostrado la imagen del colaborador encontrado
procedure TfrmAsistencia.tcorrectoTimer(Sender: TObject);
begin
  lblCedula.Visible := false;
      begin
       IFoto.Picture.LoadFromFile('c:\EDD TXT TECNOLOGIA MARCACION\fotos\picture03.png');
      end;
      lblNombre.Visible := false;
      edtCedula.Text := '';
      edtCedula.setFocus;
      tcorrecto.Enabled:= false;

end;
//Muestra hola al usuario
procedure TfrmAsistencia.Timer1Timer(Sender: TObject);
begin
LblHora.Caption := FormatDateTime('hh:mm:ss ampm',Now);
end;

saludos

novato_erick
Responder Con Cita