Ver Mensaje Individual
  #1  
Antiguo 11-08-2020
Avatar de newtron
[newtron] newtron is offline
Membrillo Premium
 
Registrado: abr 2007
Ubicación: Motril, Granada
Posts: 4.214
Reputación: 24
newtron Va camino a la fama
Apertura de cajón con Delphi Berlín

Hola a tod@s.


He pasado una aplicación de Delphi 2007 a Delphi Berlín y me encuentro con el problema de que no me funciona la apertura del cajón. El caso es que el mismo código que funciona con 2007 no funciona con Berlín y es el siguiente:


Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);

  function CreaLinea: String;
  var
    sAux: String;
  begin

    Result := '';

    sAux := '27 112 0 20 200';
    while Pos(' ', sAux) > 0 do begin

      try
        Result := Result + Chr(StrToInt(Copy(sAux, 1, Pos(' ', sAux)-1)));
      except

      end;

      sAux := TrimLeft(Copy(sAux, Pos(' ', sAux)+1, Length(sAux)));

    end;

    try
      Result := Result + Chr(StrToInt(sAux));
    except

    end;

  end;

var
  DocInfo1: TDocInfo1;
  Handle:   THandle;
  Linea:    String;
  N:        DWORD;
begin
  if not OpenPrinter(PChar('PRP-300'), Handle, nil) then begin
    ShowMessage('Error en OpenPrinter : ');
    Exit;
  end;

  with DocInfo1 do begin
    pDocName    := PChar('CAJON');
    pOutputFile := nil;
    pDataType   := 'RAW';
  end;

  StartDocPrinter(Handle, 1, @DocInfo1);

  StartPagePrinter(Handle);

  Linea := CreaLinea;
  WritePrinter(Handle, PChar(Linea), Length(Linea), N);

  EndPagePrinter(Handle);

  EndDocPrinter(Handle);

  ClosePrinter(Handle);

end;


Imagino que será algo del juego de caracteres Ansi/UTF o algo así pero la verdad es que no doy con la tecla.


Gracias y un saludo
__________________
Be water my friend.
Responder Con Cita