添加一个EDIT和一个按钮控件
//调用一个打印机的DLL如下的程序能正常运行的,问题在注释语句中
const
TestLib = 'c:\test\ez2000.dll';
procedure openport(port:PChar); stdcall; external TestLib ;
procedure setup(a, b, c, d, e, f:Integer); stdcall; external TestLib;
procedure sendcommand(command:PChar); stdcall; external TestLib;
procedure intloadimage(filename, image_name, image_type:PChar); stdcall; external TestLib;
procedure extloadimage(filename, image_name, image_type:PChar); stdcall; external TestLib;
procedure ecTextOutR(x:integer;y:integer;b:integer;c:PChar;d:PChar;e:integer;f:integer;g:integer); stdcall; external TestLib;
procedure closeport; stdcall; external TestLib;
var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
a:string;
begin openport('0'); //打印端口为并口 1
sendcommand('^Q30,2');//标标的高为30,间隙为2
sendcommand('^W104'); //标签宽度为104
sendcommand('^E12'); //停歇点为12
sendcommand('^H6'); //打印温度为6 sendcommand('^S2'); //打印速度为2
sendcommand('^AT');
sendcommand('^P1'); //打印张数为1张问:在这这里改为sendcommand('^P'+Edit1.Text);为什么不行呀?
sendcommand('^R0');
sendcommand('~Q+0');
sendcommand('^O0');
sendcommand('^D0');
sendcommand('~R200');
sendcommand('^L');
ecTextOutR(100, 78, 50, '宋体', '中文测试R', 10, 80, 0);
sendcommand('E');
closeport;end;end.
//调用一个打印机的DLL如下的程序能正常运行的,问题在注释语句中
const
TestLib = 'c:\test\ez2000.dll';
procedure openport(port:PChar); stdcall; external TestLib ;
procedure setup(a, b, c, d, e, f:Integer); stdcall; external TestLib;
procedure sendcommand(command:PChar); stdcall; external TestLib;
procedure intloadimage(filename, image_name, image_type:PChar); stdcall; external TestLib;
procedure extloadimage(filename, image_name, image_type:PChar); stdcall; external TestLib;
procedure ecTextOutR(x:integer;y:integer;b:integer;c:PChar;d:PChar;e:integer;f:integer;g:integer); stdcall; external TestLib;
procedure closeport; stdcall; external TestLib;
var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
a:string;
begin openport('0'); //打印端口为并口 1
sendcommand('^Q30,2');//标标的高为30,间隙为2
sendcommand('^W104'); //标签宽度为104
sendcommand('^E12'); //停歇点为12
sendcommand('^H6'); //打印温度为6 sendcommand('^S2'); //打印速度为2
sendcommand('^AT');
sendcommand('^P1'); //打印张数为1张问:在这这里改为sendcommand('^P'+Edit1.Text);为什么不行呀?
sendcommand('^R0');
sendcommand('~Q+0');
sendcommand('^O0');
sendcommand('^D0');
sendcommand('~R200');
sendcommand('^L');
ecTextOutR(100, 78, 50, '宋体', '中文测试R', 10, 80, 0);
sendcommand('E');
closeport;end;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货