以立象條碼打印機的動態(tài)庫PPLB為例
首先聲明函數(shù)
function B_Set_Darkness ( darkness:integer):integer;stdcall;external 'WINPPLB.DLL' //設(shè)置打印溫度
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' //打印文字(只能是條碼機內(nèi)置字體文字)
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' //關(guān)閉條形碼打印機
在Form上的一控件事件中輸入以下代碼即可打?。?/p>
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 調(diào)用PPLB));
B_Print_Out(1);
B_ClosePrn;