Printer Driver is not specified

1

I am using tsclib.dll to print labels on Bematech LB-1000. In the procedure openport () already gives the error Printer Driver is not specified.

The printer is local, USB port and I am passing its name as a parameter like this:

openport ('Bematech');

as explained in the dll instruction manual. But even following the instructions, this error continues. Using the printer's own commands, it works normally. I believe the problem is really in the dll.

Has anyone ever had this problem and do you know how to help me?

code:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    Button1: TButton;
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
{$R GenericLIB.RES}

procedure openport(PrinterName:pchar);stdcall;far; external 'tsclib.dll';
procedure closeport; external 'tsclib.dll';
procedure sendcommand(Command:pchar);stdcall;far;external 'tsclib.dll';
procedure setup(LabelWidth, LabelHeight, Speed, Density, Sensor, Vertical,             Offset:pchar);stdcall; far; external 'tsclib.dll';
procedure downloadpcx(Filename,ImageName:pchar);stdcall;far;external     'tsclib.dll';
procedure barcode(X, Y, CodeType, Height, Readable, Rotation, Narrow, Wide,     Code :pchar); stdcall; far; external 'tsclib.dll';
procedure printerfont(X, Y, FontName, Rotation, Xmul, Ymul,     Content:pchar);stdcall;far; external 'tsclib.dll';
procedure clearbuffer; external 'tsclib.dll';
procedure printlabel(NumberOfSet, NumberOfCopoy:pchar);stdcall; far;external     'C:\Windows\System32\tsclib.dll';
procedure formfeed;external 'tsclib.dll';
procedure nobackfeed; external 'tsclib.dll';
procedure windowsfont (X, Y, FontHeight, Rotation, FontStyle, FontUnderline : integer; FaceName, TextContect:pchar);stdcall;far;external 'tsclib.dll';

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;

begin

  openport('Bematech');
        for i:=1 to 1 do
         begin
          clearbuffer;
          sendcommand('DIRECTION 1');
          windowsfont(10, 10, 30, 0, 2, 0, 'arial', 'Exemplo LB - 1000     Delphi - Bematech');
          barcode('10', '100', '128', '100', '1', '0', '2', '2', '1234567-    BEMATECH');
          printlabel('1', '1');
        end;
          closeport;


end;

end.
    
asked by anonymous 07.02.2017 / 14:14

1 answer

3

I was able to solve my problem with the help of Bematech Support. Follow the Solution:

First of all, the sample code available on the Bematech website is for Delphi 7. My IDE is Delphi 10. I already got the wrong rsrs. I really did not mind that. According to the analyst, "The problem occurs due to the divergence in the structure of the variables that has alphabetic characters between the Delphi version 7 and later. It is mandatory to use Ansi variables in calls of the DLL functions that have to be passed String or Char . "

So I got the support of the version of the application in Delphi 10 and it worked. The DLL and driver are correct.

If someone is interested in getting the source code this is the link to download: link

To everyone who tried to help, thank you!

    
09.02.2017 / 16:12