以立象条码打印机的动态库PPLB为例
首先声明函数
function B_Set_Darkness ( darkness:integer):integer;stdcall;external 'WINPPLB.DLL' //设置打印温度
function B_CreatePrn ( selection:integer;FileName:pchar):integer;stdcall;external 'WINPPLB.DLL' //开始操作条码机
function B_Print_Out ( copypiece:integer):integer;stdcall;external 'WINPPLB.DLL' //打印输出
function B_Prn_Text ( x,y,ori,font,hor_factor,ver_factor:integer;mode:char;data:pchar):integer;stdcall;external 'WINPPLB.DLL' //打印文字(只能是条码机内置字体文字)
function B_Prn_Barcode ( x,y,ori:integer;typee:pchar;narrow,width,height:integer;human:char;data:pchar):integer;stdcall;external 'WINPPLB.DLL' //打印条码
function B_Prn_Text_TrueType ( x,y,FSize:integer;FType:pchar;Fspin,FWeight,FItalic,FUnline,FStrikeOut:integer;id_name,data:pchar):integer;stdcall;external 'WINPPLB.DLL' //打印文字(Windows字体文字)
function B_Get_Pcx ( x,y:integer;filename:pchar):integer;stdcall;external 'WINPPLB.DLL' //存储一个图片至条码打印机的RAM(只能是PCX的图片格式)
Procedure B_ClosePrn ();stdcall;external 'WINPPLB.DLL' //关闭条形码打印机
在Form上的一控件事件中输入以下代码即可打印:
B_CreatePrn(1, pchar('pplbtest.txt'));
B_Set_Darkness(12);
B_Get_Pcx(20, 50, pchar('sample.pcx'));
B_Prn_Barcode(20, 150, 0, '1', 2, 2, 40, 'b', pchar('1234567'));
B_Prn_Text(20, 220, 0, 4, 1, 1, 'n',pchar('BARCODE PRINTER PPLB TEST'));
B_Prn_Text_TrueType(20, 270, 40, pchar('宋体), 1, 400, 0, 0, 0, pchar('AA'), pchar('打印测试));
B_Prn_Text_TrueType(20, 350, 40, pchar('楷体), 1, 400, 0, 0, 0, pchar('AB'), pchar('Dlephi 调用PPLB));
B_Print_Out(1);
B_ClosePrn;
如转载请注明来路: http://www.lesain.com/fwzc/tiaomazhishi/BarocdeTechnology/Delphi_PPLB_DLL.html