条码库Zint.dll的调用学习
Zint条形码动态库开源免费.
优秀的开源的条码动态库,它支持超过50种条码,囊括目前市场上主流的条码类型,包括 QR、PDF417 ,等等
更多介绍请看官方网站 https://zint.org.uk/
Source Code
libZint 条码aardio封装库下载:
请先将aardio升级到v27.11版本及以上, 这个扩展库需要新功能的支持!
注意:
下面所有的帖子和回复都是历史记录, 并非更新, 最新版是上面这个链接.
以下内容为本帖历史记录:
下面是v270版本dll文件↓↓↓
关于V270版本的调用示例, 请看楼下6楼代码
下面是V230版本dll文件↓↓↓
关于V230版本的调用示例, 请看楼下5楼代码
v270版本H头文件
命令行支持方式文件zint.exe
zint源码下载:
这个dll可以加载到aardio的内存中不用释放使用, 所以可以生成绿色版软件,
dll调用方式也已经写完, 代码示例 请到本帖5楼查看。
第一种方式: 命令行方式
群里 巴克队长 提供了命令行的方式 代码如下
//条码生成 import color import fsys import fsys.dlg import win.dlg.color; import process.popen; import com.excel; import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=744;bottom=451;border="dialog frame") winform.add( btImportExcel={cls="plus";text="填写模板";left=228;top=251;right=288;bottom=281;dl=1;dt=1;notify=1;z=2}; btPreview={cls="plus";text="预览";left=15;top=251;right=75;bottom=281;dl=1;dt=1;notify=1;z=12}; btSave={cls="plus";text="保存图片";left=92;top=251;right=152;bottom=281;dl=1;dt=1;notify=1;z=13}; btSaveAs={cls="plus";text="保存到:";left=15;top=209;right=75;bottom=239;dl=1;dt=1;transparent=1;z=27}; btStartAll={cls="plus";text="批量生成";left=309;top=251;right=369;bottom=281;dl=1;dt=1;notify=1;z=10}; ckbShowText={cls="plus";text='\uF0C8 显示条码值';left=19;top=188;right=107;bottom=205;align="left";dl=1;dt=1;font=LOGFONT(h=-13;name='FontAwesome');notify=1;transparent=1;z=24}; clrBackground={cls="plus";left=190;top=149;right=235;bottom=170;bgcolor=16777215;dl=1;dt=1;notify=1;z=23}; clrFrontground={cls="plus";left=69;top=149;right=114;bottom=170;bgcolor=0;dl=1;dt=1;notify=1;z=21}; ddlBoderType={cls="combobox";left=71;top=80;right=211;bottom=100;dl=1;dt=1;edge=1;items={"无边框";"上下边框";"四周边框"};mode="dropdown";z=19}; ddlCodeType={cls="combobox";left=71;top=12;right=371;bottom=32;dl=1;dt=1;edge=1;hscroll=1;items={};mode="dropdownlist";vscroll=1;z=11}; ddlPicType={cls="combobox";left=311;top=79;right=372;bottom=99;dl=1;dt=1;edge=1;items={"PNG";"BMP";"GIF";"EPS";"PCX";"SVG";"TIF";"TXT"};mode="dropdown";z=26}; ddlRotate={cls="combobox";left=308;top=149;right=369;bottom=169;dl=1;dt=1;edge=1;items={"0";"90";"180";"270"};mode="dropdownlist";z=32}; etBorderW={cls="plus";text="2";left=69;top=114;right=108;bottom=135;border={bottom=1;color=-16777216};dl=1;dt=1;editable=1;valign="top";z=7}; etCodeString={cls="plus";left=69;top=47;right=371;bottom=64;border={bottom=1;color=-16777216};dl=1;dt=1;editable=1;valign="top";z=8}; etHeight={cls="plus";text="50";left=190;top=114;right=235;bottom=135;border={bottom=1;color=-16777216};dl=1;dt=1;editable=1;valign="top";z=5}; etLog={cls="edit";left=15;top=297;right=738;bottom=445;db=1;dl=1;dr=1;dt=1;edge=1;hscroll=1;multiline=1;readonly=1;vscroll=1;z=33}; etSaveDir={cls="plus";left=90;top=218;right=369;bottom=235;border={bottom=1;color=-16777216};dl=1;dt=1;valign="top";z=6}; etWhiteSpace={cls="plus";text="2";left=311;top=114;right=372;bottom=135;border={bottom=1;color=-16777216};dl=1;dt=1;editable=1;valign="top";z=4}; plusPicPreview={cls="plus";left=391;top=26;right=738;bottom=278;bgcolor=12639424;dl=1;dr=1;dt=1;z=1}; rbBold={cls="plus";text='\uF10C 大号';left=188;top=188;right=239;bottom=205;dl=1;dt=1;font=LOGFONT(h=-14;name='FontAwesome');notify=1;valign="top";z=30}; rbNomal={cls="plus";text='\uF10C 常规';left=122;top=188;right=173;bottom=205;dl=1;dt=1;font=LOGFONT(h=-14;name='FontAwesome');notify=1;valign="top";z=29}; rbSmall={cls="plus";text='\uF10C 小号';left=254;top=188;right=305;bottom=205;dl=1;dt=1;font=LOGFONT(h=-14;name='FontAwesome');notify=1;valign="top";z=31}; static={cls="static";text="条码预览";left=414;top=6;right=530;bottom=20;dl=1;dt=1;transparent=1;z=3}; static10={cls="static";text="图片类型";left=253;top=81;right=308;bottom=95;dl=1;dt=1;transparent=1;z=25}; static12={cls="static";text="旋转角度";left=253;top=151;right=308;bottom=165;dl=1;dt=1;transparent=1;z=28}; static2={cls="static";text="选择编码";left=15;top=14;right=70;bottom=28;dl=1;dt=1;transparent=1;z=9}; static3={cls="static";text="条码内容";left=15;top=48;right=70;bottom=62;dl=1;dt=1;transparent=1;z=14}; static4={cls="static";text="条码高度";left=134;top=117;right=189;bottom=131;dl=1;dt=1;transparent=1;z=15}; static5={cls="static";text="边框宽度";left=15;top=117;right=70;bottom=131;dl=1;dt=1;transparent=1;z=16}; static6={cls="static";text="两端空白";left=253;top=117;right=308;bottom=131;dl=1;dt=1;transparent=1;z=17}; static7={cls="static";text="边框类型";left=15;top=82;right=70;bottom=96;dl=1;dt=1;transparent=1;z=18}; static8={cls="static";text="条码颜色";left=15;top=151;right=70;bottom=165;dl=1;dt=1;transparent=1;z=20}; static9={cls="static";text="背景颜色";left=134;top=151;right=189;bottom=165;dl=1;dt=1;transparent=1;z=22} ) /*}}*/ /*编码类型表{{*/ var codeTypeTab={ ["Code 11"]=1; ["标准25码"]=2; ["交错25码"]=3; ["IATA25码"]=4; ["Code 25 Data Logic"]=6; ["工业25码"]=7; ["Code 39"]=8; ["Code 39+"]=9; ["EAN (包括EAN-8和EAN-13)"]=13; ["EAN + Check Digit"]=14; ["GS1-128 (UCC.EAN-128)"]=16; ["Codabar"]=18; ["Code 128 (自动子集转换)"]=20; ["德乌特什邮政莱特码"]=21; ["Deutshe 邮政标识码"]=22; ["Code 16K"]=23; ["Code 49"]=24; ["Code 93"]=25; ["Flattermarken"]=28; ["GS1 DataBar-14"]=29; ["GS1 DataBar Limited"]=30; ["GS1 DataBar Extended"]=31; ["Telepen Alpha"]=32; ["UPC A"]=34; ["UPC A + Check Digit"]=35; ["UPC E"]=37; ["UPC E + Check Digit"]=38; ["PostNet"]=40; ["MSI Plessey"]=47; ["FIM"]=49; ["LOGMARS"]=50; ["Pharmacode One-Track"]=51; ["PZN"]=52; ["Pharmacode Two-Track"]=53; ["PDF417"]=55; ["PDF417 Truncated"]=56; ["Maxicode"]=57; ["二维码"]=58; ["Code 128(子集B)"]=60; ["Australia Post Standard Customer"]=63; ["Australia Post Reply Paid"]=66; ["Australia Post Routing"]=67; ["Australia Post Redirection"]=68; ["ISBN (EAN-13 with verification stage)"]=69; ["Royal Mail 4 State (RM4SCC)"]=70; ["Data Matrix (ECC200)"]=71; ["EAN-14"]=72; ["Vehicle Identification Number (America)"]=73; ["Codablock-F"]=74; ["NVE-18"]=75; ["Japanese Postal Code"]=76; ["Korea Post"]=77; ["GS1 DataBar-14 Stacked"]=79; ["GS1 DataBar-14 Stacked Omnidirectional"]=80; ["GS1 DataBar Expanded Stacked"]=81; ["PLANET"]=82; ["MicroPDF417"]=84; ["USPS OneCode"]=85; ["Plessey Code"]=86; ["Telepen Numeric"]=87; ["ITF-14"]=89; ["Dutch Post KIX Code"]=90; ["Aztec Code"]=92; ["DAFT Code"]=93; ["Micro QR Code"]=97; ["HIBC Code 128"]=98; ["HIBC Code 39"]=99; ["HIBC Data Matrix ECC200"]=102; ["HIBC QR Code"]=104; ["HIBC PDF417"]=106; ["HIBC MicroPDF417"]=108; ["HIBC Aztec Code"]=112; ["DotCode"]=115; ["Han Xin (Chinese Sensible) Code"]=116; ["Royal Mail 4-state Mailmark"]=121; ["Aztec Runes"]=128; ["Code 32"]=129; ["Composite Symbol with EAN linear component"]=130; ["Composite Symbol with GS1-128 linear component"]=131; ["Composite Symbol with GS1 DataBar-14 linear component"]=132; ["Composite Symbol with GS1 DataBar Limited component"]=133; ["Composite Symbol with GS1 DataBar Extended component"]=134; ["Composite Symbol with UPC A linear component"]=135; ["Composite Symbol with UPC E linear component"]=136; ["Composite Symbol with GS1 DataBar-14 Stacked component"]=137; ["Composite Symbol with GS1 DataBar-14 Stacked Omnidirectional component"]=138; ["Composite Symbol with GS1 DataBar Expanded Stacked component"]=139; ["Channel Code"]=140; ["Code One"]=141; ["Grid Matrix"]=142; ["UPNQR (Univerzalnega Plačilnega Naloga QR)"]=143; } /*}}*/ for(codeName,codeIndex in codeTypeTab){ winform.ddlCodeType.add(codeName) } winform.ddlCodeType.selIndex=1 var tempPicPath=fsys.joinpath(fsys.getTempDir(),"zint.png") //临时输出文件的位置 var zint="\res\zint.exe" //获取颜色 var setColor=function(ctrl){ var colorDlg=win.dlg.color(winform) var newClr=colorDlg.choose() if(newClr===null){return ; } ctrl.background=color.argbReverse(newClr) //ctrl.redrawBackground() } //获取颜色 var getColor=function(ctrl){ var clr=ctrl.backgroundColor var r,g,b=color.getRgb(clr) clr=string.format("%.2X",b ) ++ string.format("%.2X",g )++string.format("%.2X",r ) clr=string.replace(clr,"@0x","") return clr; } /* 函数用途:生成命令行参数 函数参数:无 函数返回:preCmdStr */ var getPreCmdStr=function(){ var args={} var barType="--barcode=" ++codeTypeTab[winform.ddlCodeType.selText] //条码类型代码 table.push(args,barType) var haveText=winform.ckbShowText.checked?"":"--notext" // 是否下方显示文字 if(!#haveText){ var fontSize // 字体大小 fontSize= winform.rbNomal.checked ? "" : winform.rbBold.checked ? "--bold" : "--small" if(#fontSize){ table.push(args,fontSize) } }else { table.push(args,haveText) } if(#winform.etHeight.text){ // 条码高度 var height='--height='++winform.etHeight.text table.push(args,height) } if(#winform.etWhiteSpace.text){ var whitespace="-w "++winform.etWhiteSpace.text //左右两侧的空白宽度 table.push(args,whitespace) } var scale='--scale=1' // X轴比例,默认为2 var frontground="--fg="++getColor(winform.clrFrontground) //条码颜色 var background ="--bg="++getColor(winform.clrBackground) //背景颜色 table.push(args,scale,frontground,background) var bouderW //边框宽度 if(#winform.etBorderW.text){ bouderW="--border="++winform.etBorderW.text //边框宽度 } var borderType=winform.ddlBoderType.selText // 边框类型 select(borderType) { //无边框;上下边框;四周边框 case "无边框"{ borderType="" } case "上下边框" { borderType="--bind" table.push(args,borderType,bouderW) } case "四周边框" { borderType="--box" table.push(args,borderType,bouderW) } } var rotate="--rotate="++winform.ddlRotate.selText //图形旋转 table.push(args,rotate) return string.join(args,' ') } /* 函数作用:生成最终的命令行参数 函数参数: 1、preCmdStr,所有命令行数组成员的公共参数,有 getPreCmdStr()获取 2、barStr,条码值。winform.etCodeString.text或从文件读取的值 3、filetype,要保存的文件类别,=winform.ddlPicType.selText 4、filePath,只用在批量模式中,文件第一列获取值,并与winform.etSaveDir.text组合成的文件路径值 函数返回:cmdStr */ var getFinalCmdStr=function(preCmdStr,barStr,filetype,filePath){ //var args={preCmdStr;"--filetype="++filetype;} var args={preCmdStr} if(!filePath) { //没有传入name字段,则证明是单张保存或预览 var list="" filePath=fsys.dlg.save("图形文件(*."++filetype++")|*."++filetype,"图片另存为",,,,barStr) if(!filePath){return ; } } filePath = '-o '++ filePath table.push(args,filePath) barStr='-d '++ barStr //条码字符串内容,特别注意,该参数必须是最后一个参数 table.push(args,barStr) return string.join(args,' ') } /* 函数作用:调用zint生成图片(或预览,通过修改isPreview状态) 函数参数:cmdStrs 命令行,或命令行数组 函数返回:zint.exe打开失败,返回false;正常组件正常返回true,如果错误,则日志显示错误信息 */ createZbar=function(isPreview=true,...){ var cmdStrs = ( type(...)==type.table ) ? ... : { ... } //检查组件状态 winform.etLog.text="" for(i=1;#cmdStrs;1){ var cmdStr=cmdStrs[i] var prcs=process.popen(zint,cmdStr) //zint默认运行后直接退出,无法保持持续输入状态,只能每次调用 if(prcs==null){ winform.etLog.appendText('组件丢失或加载失败,程序无法继续!\r\n') return false; } //prcs.write(cmdStr) //读取返回的出错信息 var err=prcs.readErr(-1) prcs.close() if(#err){ var codeString=string.match(cmdStr,"-d (.+)"):"未设置条码值" winform.etLog.appendText('失败条码值:',codeString,';原因:'++err,'\r\n') continue ; } if(isPreview){ //预览状态更新右侧的条码图片 var bin=string.load(tempPicPath) //直接设置为plus背景,图片会被占用状态 winform.plusPicPreview.background=bin } } return true; } //设置前景色颜色 winform.clrFrontground.oncommand = function(id,event){ setColor(owner) } //设置条码背景色 winform.clrBackground.oncommand = function(id,event){ setColor(owner) } //预览 winform.btPreview.oncommand = function(id,event){ var preCmdStr= getPreCmdStr() preCmdStr = preCmdStr++" "++"-o " ++tempPicPath var barStr='-d '++ winform.etCodeString.text //条码字符串内容,特别注意,该参数必须是最后一个参数 preCmdStr = preCmdStr++" "++barStr createZbar(true,preCmdStr) } //保存图片 winform.btSave.oncommand = function(id,event){ var preCmdStr= getPreCmdStr() var filetype=winform.ddlPicType.selText var barStr=winform.etCodeString.text var cmdStr=getFinalCmdStr(preCmdStr,barStr,filetype) createZbar(false,cmdStr) } var excel,book,sheet,dealFunc //填写模板 winform.btImportExcel.oncommand = function(id,event){ excel=com.excel(1) book=excel.WorkBooks.Add() sheet=book.workSheets(1) sheet.name="条码模板" sheet.Range("A1:B2").formula={{"保存文件名";"条码值"};{"铅笔条码";"1234567890"}} excel.Visible=true } //批量生成条形码 winform.btStartAll.oncommand = function(id,event){ if(!sheet){ winform.msgboxErr("请先点击填写模板按钮,在模板中填写并保存后在开始生成","无效模板文件") return ; } var dir=io.exist(winform.etSaveDir.text) if(!dir){ winform.msgboxErr("请先设置保存图片的路径","无效的路径") return ; } winform.btStartAll.disabled=true var rowsCount try{ //可能会提前关闭文件 rowsCount=sheet.cells(1,1).currentRegion.rows.count } catch(e){ rowsCount=0 winform.msgboxErr("模板文件疑似已经提前关闭,数据无法读取","模板已关闭") } var dir=io.exist(winform.etSaveDir.text) var filetype=winform.ddlPicType.selText dir:=fsys.joinpath(io._exedir,"导出条码") //如果未设定目录,则默认保存到当前目录 var preCmdStr=getPreCmdStr() var cmdStrs={} for(i=2;rowsCount;1){ var oneLine=sheet.Rows(i).value()[[1]] var filename=oneLine[1] : i //文件名为第一列值,或者索引值 var filePath=fsys.joinpath(dir,filename++"."++filetype) var barStr=oneLine[[2]]:"" //条码值是第二列 var cmdStr=getFinalCmdStr(preCmdStr,barStr,filetype,filePath) table.push(cmdStrs,cmdStr) } createZbar(false,cmdStrs) winform.msgbox("全部完成,请检查日志信息看是否有未执行成功的条目") } for(name,ctrl in winform.eachControl("combobox") ){ ctrl.selIndex := 1 } winform.show(); win.loopMessage(); return winform;
mySymbol2.symbology = 58 //编码类型 //mySymbol2.height = 200 //条码高度,增加1增高2像素 //mySymbol2.width = 100 //条码宽度,同上 //mySymbol2.whitespace_width = 20 //条码白边宽度,上下左右四处,同上 //mySymbol2.border_width = 2 //边框宽度,上下左右四处, 同上 mySymbol2.fgcolour = raw.buffer("325454");//前景色(字节) mySymbol2.bgcolour = raw.buffer("FE00FE");//背景色(字节) mySymbol2.scale = 1.5 //缩放比例 //mySymbol2.show_hrt = 1 //是否在条码下方显示文本 //mySymbol2.text = raw.buffer('NO IMG');//条码下方显示的文本
上面的参数都测试过了, 是正确的, 后面慢慢测试其他几个参数
颜色值是参考下面这个地方的:
终于测试完所有的功能:
可以直接在aardio的内存中生成条码并一步到位显示到界面上, 而不用保存到本地然后调用显示了!
下面演示的还是v230版本的dll , 请注意.
完整的代码如下:
import win.ui; /*DSG{{*/ mainForm = win.form(text="Zint条码使用";right=433;bottom=365) mainForm.add( picturebox={cls="picturebox";left=52;top=43;right=379;bottom=332;z=1} ) /*}}*/ import console console.open() var dll = ..raw.loadDll("\res\zint.dll",,"cdecl"); //struct zint_symbol *ZBarcode_Create(void); ZBarcodeCreate = dll.api("ZBarcode_Create","pointer()" ) //void ZBarcode_Clear(struct zint_symbol *symbol); ZBarcodeClear = dll.api("ZBarcode_Clear","void(pointer symbol)" ) //void ZBarcode_Delete(struct zint_symbol *symbol); ZBarcodeDelete = dll.api("ZBarcode_Delete","void(pointer symbol)" ) //int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int in_length); ZBarcodeEncode = dll.api("ZBarcode_Encode","int(pointer symbol,string source,int in_length)" ) //int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename); ZBarcodeEncodeFile = dll.api("ZBarcode_Encode_File","int(pointer symbol, string filename)" ) //int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle); ZBarcodePrint = dll.api("ZBarcode_Print","int(pointer symbol, int rotate_angle)" ) //int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); ZBarcodeEncodeandPrint = dll.api("ZBarcode_Encode_and_Print","int(pointer symbol, string input, int length, int rotate_angle)" ) //int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, int rotate_angle); ZBarcodeEncodeFileandPrint = dll.api("ZBarcode_Encode_File_and_Print","int(pointer symbol, string filename,int rotate_angle)" ) //int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle); ZBarcodeBuffer = dll.api("ZBarcode_Buffer","int(pointer symbol, int rotate_angle)" ) //int ZBarcode_Buffer_Vector(struct zint_symbol *symbol, int rotate_angle); //ZBarcodeBufferVector = dll.api("ZBarcode_Buffer_Vector","int(struct symbol, int rotate_angle)" ) //int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); ZBarcodeEncodeandBuffer = dll.api("ZBarcode_Encode_and_Buffer","int(pointer symbol, string input, int length, int rotate_angle)" ) //int ZBarcode_Encode_and_Buffer_Vector(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); //ZBarcodeEncodeandBufferVector = dll.api("ZBarcode_Encode_and_Buffer_Vector","int(struct symbol, string input, int length, int rotate_angle)" ) //int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle); ZBarcodeEncodeFileandBuffer = dll.api("ZBarcode_Encode_File_and_Buffer","int(pointer symbol, string filename,int rotate_angle)" ) //int ZBarcode_Encode_File_and_Buffer_Vector(struct zint_symbol *symbol, char *filename, int rotate_angle); //ZBarcodeEncodeFileandBufferVector = dll.api("ZBarcode_Encode_File_and_Buffer_Vector","int(struct symbol, string filename,int rotate_angle)" ) //初始化条码,返回结构体指针 var mySymbol = ZBarcodeCreate(); //将指针转换为aar的结构体 var mySymbol2 = raw.convert(mySymbol,{ int symbology; //int symbology; int height; //int height; int whitespace_width; //int whitespace_width; int border_width; //int border_width; int output_options; //int output_options; byte fgcolour[10]; //char fgcolour[10]; byte bgcolour[10]; //char bgcolour[10]; byte outfile[256]; //char outfile[256]; float scale; //float scale; int option_1; //int option_1; int option_2; //int option_2; int option_3; //int option_3; int show_hrt; //int show_hrt; //int fontsize; //int fontsize; int input_mode; //int input_mode; //int eci; //int eci; BYTE text[128]; //unsigned char text[128]; int rows; //int rows; int width; //int width; byte primary[128]; //char primary[128]; BYTE encoded_data[25454];//unsigned char encoded_data[200][143]; int row_height[178]; //int row_height[178]; byte errtxt[100]; //char errtxt[100]; pointer bitmap; //char *bitmap; int bitmap_width; //int bitmap_width; int bitmap_height; //int bitmap_height; //INT bitmap_byte_length; //unsigned int bitmap_byte_length; //float dot_size; //float dot_size; //pointer vector; //struct zint_vector *vector; pointer rendered; //struct zint_render *rendered; //int debug; //int debug; }); //修改结构体中的数据 mySymbol2.outfile = ".\\img\out3.png" mySymbol2.symbology = 58 //编码类型 //mySymbol2.height = 200 //条码高度,增加1增高2像素 //mySymbol2.width = 100 //条码宽度,同上 //mySymbol2.whitespace_width = 20 //条码白边宽度,上下左右四处,同上 //mySymbol2.border_width = 2 //边框宽度,上下左右四处, 同上 mySymbol2.fgcolour = raw.buffer("000000");//前景色(字节) mySymbol2.bgcolour = raw.buffer("ffffff");//背景色(字节) mySymbol2.scale = 5 //缩放比例 //mySymbol2.show_hrt = 1 //是否在条码下方显示文本 //mySymbol2.text = raw.buffer('NO IMG');//条码下方显示的文本 //将结构体变换到指针 raw.copy(mySymbol,mySymbol2) //设置条码数据 var ret = ZBarcodeEncode(mySymbol,"Aardio是真的好用!",0); //这里返回0 说明成功编码了 console.log(ret) //保存图像数据到本地图像 //var ret = ZBarcodePrint(mySymbol,0); //保存图像数据到系统内存buff中 var ret = ZBarcodeBuffer(mySymbol,0); console.log(ret) //再次变换到aar能直接使用的结构体形式 var mySymbol3 = raw.convert(mySymbol,{ int symbology; //int symbology; int height; //int height; int whitespace_width; //int whitespace_width; int border_width; //int border_width; int output_options; //int output_options; byte fgcolour[10]; //char fgcolour[10]; byte bgcolour[10]; //char bgcolour[10]; byte outfile[256]; //char outfile[256]; float scale; //float scale; int option_1; //int option_1; int option_2; //int option_2; int option_3; //int option_3; int show_hrt; //int show_hrt; //int fontsize; //int fontsize; int input_mode; //int input_mode; //int eci; //int eci; BYTE text[128]; //unsigned char text[128]; int rows; //int rows; int width; //int width; byte primary[128]; //char primary[128]; BYTE encoded_data[25454];//unsigned char encoded_data[200][143]; int row_height[178]; //int row_height[178]; byte errtxt[100]; //char errtxt[100]; pointer bitmap; //char *bitmap; int bitmap_width; //int bitmap_width; int bitmap_height; //int bitmap_height; //INT bitmap_byte_length; //unsigned int bitmap_byte_length; //float dot_size; //float dot_size; //pointer vector; //struct zint_vector *vector; pointer rendered; //struct zint_render *rendered; //int debug; //int debug; }); //导入画板 import gdip.bitmap var bbp = gdip.bitmap(mySymbol3.bitmap_width,mySymbol3.bitmap_height); //将指针数据变换为字节数据(一个像素有三基色, 是以RGB三个连续字节表示) var buff = raw.buffer(raw.tostring(mySymbol3.bitmap,1,mySymbol3.bitmap_width*mySymbol3.bitmap_height*3)); var index = 1; for(i=1;mySymbol3.bitmap_height;1){ for(j=1;mySymbol3.bitmap_width;1){ //设置像素颜色ARGB bbp.setPixel(i,j,gdi.ARGB(buff[index],buff[index+1],buff[index+2],0xff)); index += 3; } } //不知道为什么需要沿着x轴垂直翻转下?? bbp.rotateFlip(5/*_Rotate90FlipX*/) mainForm.picturebox.setBitmap(bbp.copyHandle()) //参照错误码 // Warning and error conditions //#define ZINT_WARN_INVALID_OPTION 2 //#define ZINT_WARN_USES_ECI 3 //#define ZINT_ERROR_TOO_LONG 5 //#define ZINT_ERROR_INVALID_DATA 6 //#define ZINT_ERROR_INVALID_CHECK 7 //#define ZINT_ERROR_INVALID_OPTION 8 //#define ZINT_ERROR_ENCODING_PROBLEM 9 //#define ZINT_ERROR_FILE_ACCESS 10 //#define ZINT_ERROR_MEMORY 11 mainForm.show(); return win.loopMessage();
完整的示例工程下载:
这里备注下我写的时候遇到的问题:
结构体一定要转换正确, 如果结构体里有一个字节错误, 基本上就得不到正确效果.
我就是把之前的 int row_height[178] 写成了V270版本的[200], 导致后面的参数都是错误的
改过来之后一次就通过测试了.
哎, 还是要细心和耐心 !
此楼, 针对 v270版本 dll
特别说明: v270的dll并没有使用libpng16.dll, 所以可以内嵌到aardio中不用释放出来, 如果你不需要保存为png图片,其他版本也可以自行把源码编译出不需要png库的dll
import win.ui; /*DSG{{*/ mainForm = win.form(text="Zint条码使用";right=433;bottom=365) mainForm.add( picturebox={cls="picturebox";left=52;top=43;right=379;bottom=332;z=1} ) /*}}*/ import console console.open() var dll = ..raw.loadDll($"\res\zint.dll",,"cdecl"); //struct zint_symbol *ZBarcode_Create(void); ZBarcodeCreate = dll.api("ZBarcode_Create","pointer()" ) //void ZBarcode_Clear(struct zint_symbol *symbol); ZBarcodeClear = dll.api("ZBarcode_Clear","void(pointer symbol)" ) //void ZBarcode_Delete(struct zint_symbol *symbol); ZBarcodeDelete = dll.api("ZBarcode_Delete","void(pointer symbol)" ) //int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int in_length); ZBarcodeEncode = dll.api("ZBarcode_Encode","int(pointer symbol,string source,int in_length)" ) //int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename); ZBarcodeEncodeFile = dll.api("ZBarcode_Encode_File","int(pointer symbol, string filename)" ) //int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle); ZBarcodePrint = dll.api("ZBarcode_Print","int(pointer symbol, int rotate_angle)" ) //int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); ZBarcodeEncodeandPrint = dll.api("ZBarcode_Encode_and_Print","int(pointer symbol, string input, int length, int rotate_angle)" ) //int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, int rotate_angle); ZBarcodeEncodeFileandPrint = dll.api("ZBarcode_Encode_File_and_Print","int(pointer symbol, string filename,int rotate_angle)" ) //int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle); ZBarcodeBuffer = dll.api("ZBarcode_Buffer","int(pointer symbol, int rotate_angle)" ) //int ZBarcode_Buffer_Vector(struct zint_symbol *symbol, int rotate_angle); ZBarcodeBufferVector = dll.api("ZBarcode_Buffer_Vector","int(struct symbol, int rotate_angle)" ) //int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); ZBarcodeEncodeandBuffer = dll.api("ZBarcode_Encode_and_Buffer","int(pointer symbol, string input, int length, int rotate_angle)" ) //int ZBarcode_Encode_and_Buffer_Vector(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); ZBarcodeEncodeandBufferVector = dll.api("ZBarcode_Encode_and_Buffer_Vector","int(struct symbol, string input, int length, int rotate_angle)" ) //int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle); ZBarcodeEncodeFileandBuffer = dll.api("ZBarcode_Encode_File_and_Buffer","int(pointer symbol, string filename,int rotate_angle)" ) //int ZBarcode_Encode_File_and_Buffer_Vector(struct zint_symbol *symbol, char *filename, int rotate_angle); ZBarcodeEncodeFileandBufferVector = dll.api("ZBarcode_Encode_File_and_Buffer_Vector","int(struct symbol, string filename,int rotate_angle)" ) //初始化条码,返回结构体指针 var mySymbol = ZBarcodeCreate(); //将指针转换为aar的结构体 var mySymbol2 = raw.convert(mySymbol,{ int symbology; //int symbology; int height; //int height; int whitespace_width; //int whitespace_width; int border_width; //int border_width; int output_options; //int output_options; byte fgcolour[10]; //char fgcolour[10]; byte bgcolour[10]; //char bgcolour[10]; byte outfile[256]; //char outfile[256]; float scale; //float scale; int option_1; //int option_1; int option_2; //int option_2; int option_3; //int option_3; int show_hrt; //int show_hrt; int fontsize; //int fontsize; int input_mode; //int input_mode; int eci; //int eci; BYTE text[128]; //unsigned char text[128]; int rows; //int rows; int width; //int width; byte primary[128]; //char primary[128]; BYTE encoded_data[28600];//unsigned char encoded_data[200][143]; int row_height[200]; //int row_height[178]; byte errtxt[100]; //char errtxt[100]; pointer bitmap; //char *bitmap; int bitmap_width; //int bitmap_width; int bitmap_height; //int bitmap_height; INT bitmap_byte_length; //unsigned int bitmap_byte_length; float dot_size; //float dot_size; pointer vector; //struct zint_vector *vector; pointer rendered; //struct zint_render *rendered; int debug; //int debug; }); //修改结构体中的数据 mySymbol2.outfile = ".\\img\out3.bmp" mySymbol2.symbology = 58 //编码类型 //mySymbol2.height = 200 //条码高度,增加1增高2像素 //mySymbol2.width = 100 //条码宽度,同上 //mySymbol2.whitespace_width = 20 //条码白边宽度,上下左右四处,同上 //mySymbol2.border_width = 2 //边框宽度,上下左右四处, 同上 mySymbol2.fgcolour = raw.buffer("000000");//前景色(字节) mySymbol2.bgcolour = raw.buffer("ffffff");//背景色(字节) mySymbol2.scale = 5 //缩放比例 //mySymbol2.show_hrt = 1 //是否在条码下方显示文本 //mySymbol2.text = raw.buffer('NO IMG');//条码下方显示的文本 //将结构体变换到指针 raw.copy(mySymbol,mySymbol2) //设置条码数据 var ret = ZBarcodeEncode(mySymbol,"Aardio是真的好用!",0); //这里返回0 说明成功编码了 console.log(ret) //保存图像数据到本地图像 //var ret = ZBarcodePrint(mySymbol,0); //保存图像数据到系统内存buff中 var ret = ZBarcodeBuffer(mySymbol,0); console.log(ret) //再次变换到aar能直接使用的结构体形式 var mySymbol3 = raw.convert(mySymbol,{ int symbology; //int symbology; int height; //int height; int whitespace_width; //int whitespace_width; int border_width; //int border_width; int output_options; //int output_options; byte fgcolour[10]; //char fgcolour[10]; byte bgcolour[10]; //char bgcolour[10]; byte outfile[256]; //char outfile[256]; float scale; //float scale; int option_1; //int option_1; int option_2; //int option_2; int option_3; //int option_3; int show_hrt; //int show_hrt; int fontsize; //int fontsize; int input_mode; //int input_mode; int eci; //int eci; BYTE text[128]; //unsigned char text[128]; int rows; //int rows; int width; //int width; byte primary[128]; //char primary[128]; BYTE encoded_data[28600];//unsigned char encoded_data[200][143]; int row_height[200]; //int row_height[178]; byte errtxt[100]; //char errtxt[100]; pointer bitmap; //char *bitmap; int bitmap_width; //int bitmap_width; int bitmap_height; //int bitmap_height; INT bitmap_byte_length; //unsigned int bitmap_byte_length; float dot_size; //float dot_size; pointer vector; //struct zint_vector *vector; pointer rendered; //struct zint_render *rendered; int debug; }); //导入画板 import gdip.bitmap var bbp = gdip.bitmap(mySymbol3.bitmap_width,mySymbol3.bitmap_height); //将指针数据变换为字节数据(一个像素有三基色, 是以RGB三个连续字节表示) var buff = raw.buffer(raw.tostring(mySymbol3.bitmap,1,mySymbol3.bitmap_width*mySymbol3.bitmap_height*3)); var index = 1; for(i=1;mySymbol3.bitmap_height;1){ for(j=1;mySymbol3.bitmap_width;1){ //设置像素颜色ARGB bbp.setPixel(i,j,gdi.ARGB(buff[index],buff[index+1],buff[index+2],0xff)); index += 3; } } //不知道为什么需要沿着x轴垂直翻转下?? bbp.rotateFlip(5/*_Rotate90FlipX*/) mainForm.picturebox.setBitmap(bbp.copyHandle()) //参照错误码 // Warning and error conditions //#define ZINT_WARN_INVALID_OPTION 2 //#define ZINT_WARN_USES_ECI 3 //#define ZINT_ERROR_TOO_LONG 5 //#define ZINT_ERROR_INVALID_DATA 6 //#define ZINT_ERROR_INVALID_CHECK 7 //#define ZINT_ERROR_INVALID_OPTION 8 //#define ZINT_ERROR_ENCODING_PROBLEM 9 //#define ZINT_ERROR_FILE_ACCESS 10 //#define ZINT_ERROR_MEMORY 11 mainForm.show(); return win.loopMessage();
第一版zint库写完了
Zint.aardio 智能提示库下载(针对V270版本dll) :↓↓↓
放到工程的lib目录里即可.
以下示例完整工程代码下载:
百度网盘下载地址:
链接:https://pan.baidu.com/s/1odDaG3AEZO_wK6vIxVewhA
提取码:7xy9
简单的使用示例:
import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=581;bottom=434) winform.add( picturebox={cls="picturebox";left=89;top=41;right=483;bottom=359;db=1;dl=1;dr=1;dt=1;z=1} ) /*}}*/ import console console.open() import Zint var zsd = Zint(); zsd.symbology = 0x14/*_BARCODE_CODE128*/; zsd.outfile = ".\\img\out6.bmp" //zsd.whitespace_width = 2 zsd.borderWidth = 2 zsd.foregroundColor = 0x9613B2; //zsd.height = 100; zsd.Encode("aardio Zint LIB"); zsd.saveBuff(0); winform.picturebox.setBitmap(zsd.getBitmapHandle()) //zsd.savePic() winform.show(); win.loopMessage(); return winform;
下面是zint库的详细代码:
//Zint条码生成库 import gdip.bitmap import util.metaProperty; class Zint{ ctor( ){ this.Symbol = ZBarcodeCreate(); this.SymbolSturct = ..raw.convert(this.Symbol,{ int symbology; int height; int whitespace_width; int border_width; int output_options; byte fgcolour[10]; byte bgcolour[10]; byte outfile[256]; float scale; int option_1; int option_2; int option_3; int show_hrt; int fontsize; int input_mode; int eci; BYTE text[128]; int rows; int width; byte primary[128]; BYTE encoded_data[28600]; int row_height[200]; byte errtxt[100]; pointer bitmap; int bitmap_width; int bitmap_height; INT bitmap_byte_length; float dot_size; pointer vector; pointer rendered; int debug; }); ..table.gc(this,"delete"); }; Encode = function(str){ return ZBarcodeEncode(this.Symbol,str,0); } saveBuff = function(angle=0){ return ZBarcodeBuffer(this.Symbol,angle); } savePic = function(angle=0){ return ZBarcodePrint(this.Symbol,angle); } getBitmapHandle = function(){ this.SymbolSturct = null; this.SymbolSturct = ..raw.convert(this.Symbol,{ int symbology; int height; int whitespace_width; int border_width; int output_options; byte fgcolour[10]; byte bgcolour[10]; byte outfile[256]; float scale; int option_1; int option_2; int option_3; int show_hrt; int fontsize; int input_mode; int eci; BYTE text[128]; int rows; int width; byte primary[128]; BYTE encoded_data[28600]; int row_height[200]; byte errtxt[100]; pointer bitmap; int bitmap_width; int bitmap_height; INT bitmap_byte_length; float dot_size; pointer vector; pointer rendered; int debug; }); var bbp = ..gdip.bitmap(this.SymbolSturct.bitmap_height,this.SymbolSturct.bitmap_width); //将指针数据变换为字节数据(一个像素有三基色, 是以RGB三个连续字节表示) var buff = ..raw.buffer(..raw.tostring(this.SymbolSturct.bitmap,1,this.SymbolSturct.bitmap_width*this.SymbolSturct.bitmap_height*3)); var index = 1; for(i=1;this.SymbolSturct.bitmap_height;1){ for(j=1;this.SymbolSturct.bitmap_width;1){ //设置像素颜色ARGB bbp.setPixel(i,j,..gdi.ARGB(buff[index],buff[index+1],buff[index+2],0xff)); index += 3; } } //不知道为什么需要沿着x轴垂直翻转下?? bbp.rotateFlip(5/*_Rotate90FlipX*/); return bbp.copyHandle(); } getErr = function(){ return this.SymbolSturct.errtxt; } delete = function(){ if(this.Symbol){ ZBarcodeDelete(this.Symbol); this.Symbol = null; } } @_metaProperty; } namespace Zint{ _dll = ..raw.loadDll("\res\zint.dll","ZintLib","cdecl"); ZBarcodeCreate = _dll.api("ZBarcode_Create","pointer()" ) ZBarcodeClear = _dll.api("ZBarcode_Clear","void(pointer symbol)" ) ZBarcodeDelete = _dll.api("ZBarcode_Delete","void(pointer symbol)" ) ZBarcodeEncode = _dll.api("ZBarcode_Encode","int(pointer symbol,string source,int in_length)" ) ZBarcodeEncodeFile = _dll.api("ZBarcode_Encode_File","int(pointer symbol, string filename)" ) ZBarcodePrint = _dll.api("ZBarcode_Print","int(pointer symbol, int rotate_angle)" ) // ZBarcodeEncodeandPrint = _dll.api("ZBarcode_Encode_and_Print","int(pointer symbol, string input, int length, int rotate_angle)" ) // ZBarcodeEncodeFileandPrint = _dll.api("ZBarcode_Encode_File_and_Print","int(pointer symbol, string filename,int rotate_angle)" ) ZBarcodeBuffer = _dll.api("ZBarcode_Buffer","int(pointer symbol, int rotate_angle)" ) ZBarcodeBufferVector = _dll.api("ZBarcode_Buffer_Vector","int(struct symbol, int rotate_angle)" ) // ZBarcodeEncodeandBuffer = _dll.api("ZBarcode_Encode_and_Buffer","int(pointer symbol, string input, int length, int rotate_angle)" ) // ZBarcodeEncodeandBufferVector = _dll.api("ZBarcode_Encode_and_Buffer_Vector","int(struct symbol, string input, int length, int rotate_angle)" ) // ZBarcodeEncodeFileandBuffer = _dll.api("ZBarcode_Encode_File_and_Buffer","int(pointer symbol, string filename,int rotate_angle)" ) // ZBarcodeEncodeFileandBufferVector = _dll.api("ZBarcode_Encode_File_and_Buffer_Vector","int(struct symbol, string filename,int rotate_angle)" ) _metaProperty = ..util.metaProperty( symbology = { _set = function( value ){ owner.SymbolSturct.symbology = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.symbology; }; }; height = { _set = function( value ){ owner.SymbolSturct.height = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.height; }; }; whitespace_width = { _set = function( value ){ owner.SymbolSturct.whitespace_width = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.whitespace_width; }; }; borderWidth = { _set = function( value ){ owner.SymbolSturct.border_width = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.border_width; }; }; foregroundColor = { _set = function( value ){ var str = ..string.replace(..string.format("%06X", value),"0<x|X>",""); owner.SymbolSturct.fgcolour = ..raw.buffer(str); ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return "0x" ++ owner.SymbolSturct.fgcolour; }; }; backgroundColor = { _set = function( value ){ var str = ..string.replace(..string.format("%06X", value),"0<x|X>",""); owner.SymbolSturct.fgcolour = ..raw.buffer(str); ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return "0x" ++ owner.SymbolSturct.fgcolour; }; }; outfile = { _set = function( value ){ owner.SymbolSturct.outfile = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.outfile; }; }; scale = { _set = function( value ){ owner.SymbolSturct.scale = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.scale; }; }; showHrt = { _set = function( value ){ owner.SymbolSturct.show_hrt = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.show_hrt; }; }; fontsize = { _set = function( value ){ owner.SymbolSturct.fontsize = value; ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.fontsize; }; }; text = { _set = function( str ){ owner.SymbolSturct.text = raw.buffer(str); ..raw.copy(owner.Symbol,owner.SymbolSturct); }; _get = function(){ return owner.SymbolSturct.text; }; }; ) } /**intellisense() Zint = 条码生成库 Zint() = 初始化条码 Zint() = !ZintLib. !ZintLib.symbology = 条码编号 !ZintLib.height = 高度 !ZintLib.whitespace_width = 白边宽度 !ZintLib.borderWidth = 边框宽度 !ZintLib.foregroundColor = 前景色 !ZintLib.backgroundColor = 背景色 !ZintLib.outfile = 输出到文件 !ZintLib.scale = 缩放比 !ZintLib.showHrt = 显示底部文本 !ZintLib.fontsize = 字体尺寸 !ZintLib.text = 底部文本 !ZintLib.Encode(.(str) = 编码字符串 !ZintLib.saveBuff(.(角度) = 保存条码到内存 !ZintLib.savePic(.(角度) = 保存条码到文件 !ZintLib.getBitmapHandle() = 获取内存条码图像句柄 !ZintLib.getErr() = 获取错误信息 _BARCODE_CODE11=@0x1/*_BARCODE_CODE11*/ _BARCODE_C25MATRIX=@0x2/*_BARCODE_C25MATRIX*/ _BARCODE_C25INTER=@0x3/*_BARCODE_C25INTER*/ _BARCODE_C25IATA=@0x4/*_BARCODE_C25IATA*/ _BARCODE_C25LOGIC=@0x6/*_BARCODE_C25LOGIC*/ _BARCODE_C25IND=@0x7/*_BARCODE_C25IND*/ _BARCODE_CODE39=@0x8/*_BARCODE_CODE39*/ _BARCODE_EXCODE39=@0x9/*_BARCODE_EXCODE39*/ _BARCODE_EANX=@0xD/*_BARCODE_EANX*/ _BARCODE_EANX_CHK=@0xE/*_BARCODE_EANX_CHK*/ _BARCODE_EAN128=@0x10/*_BARCODE_EAN128*/ _BARCODE_CODABAR=@0x12/*_BARCODE_CODABAR*/ _BARCODE_CODE128=@0x14/*_BARCODE_CODE128*/ _BARCODE_DPLEIT=@0x15/*_BARCODE_DPLEIT*/ _BARCODE_DPIDENT=@0x16/*_BARCODE_DPIDENT*/ _BARCODE_CODE16K=@0x17/*_BARCODE_CODE16K*/ _BARCODE_CODE49=@0x18/*_BARCODE_CODE49*/ _BARCODE_CODE93=@0x19/*_BARCODE_CODE93*/ _BARCODE_FLAT=@0x1C/*_BARCODE_FLAT*/ _BARCODE_RSS14=@0x1D/*_BARCODE_RSS14*/ _BARCODE_RSS_LTD=@0x1E/*_BARCODE_RSS_LTD*/ _BARCODE_RSS_EXP=@0x1F/*_BARCODE_RSS_EXP*/ _BARCODE_TELEPEN=@0x20/*_BARCODE_TELEPEN*/ _BARCODE_UPCA=@0x22/*_BARCODE_UPCA*/ _BARCODE_UPCA_CHK=@0x23/*_BARCODE_UPCA_CHK*/ _BARCODE_UPCE=@0x25/*_BARCODE_UPCE*/ _BARCODE_UPCE_CHK=@0x26/*_BARCODE_UPCE_CHK*/ _BARCODE_POSTNET=@0x28/*_BARCODE_POSTNET*/ _BARCODE_MSI_PLESSEY=@0x2F/*_BARCODE_MSI_PLESSEY*/ _BARCODE_FIM=@0x31/*_BARCODE_FIM*/ _BARCODE_LOGMARS=@0x32/*_BARCODE_LOGMARS*/ _BARCODE_PHARMA=@0x33/*_BARCODE_PHARMA*/ _BARCODE_PZN=@0x34/*_BARCODE_PZN*/ _BARCODE_PHARMA_TWO=@0x35/*_BARCODE_PHARMA_TWO*/ _BARCODE_PDF417=@0x37/*_BARCODE_PDF417*/ _BARCODE_PDF417TRUNC=@0x38/*_BARCODE_PDF417TRUNC*/ _BARCODE_MAXICODE=@0x39/*_BARCODE_MAXICODE*/ _BARCODE_QRCODE=@0x3A/*_BARCODE_QRCODE*/ _BARCODE_CODE128B=@0x3C/*_BARCODE_CODE128B*/ _BARCODE_AUSPOST=@0x3F/*_BARCODE_AUSPOST*/ _BARCODE_AUSREPLY=@0x42/*_BARCODE_AUSREPLY*/ _BARCODE_AUSROUTE=@0x43/*_BARCODE_AUSROUTE*/ _BARCODE_AUSREDIRECT=@0x44/*_BARCODE_AUSREDIRECT*/ _BARCODE_ISBNX=@0x45/*_BARCODE_ISBNX*/ _BARCODE_RM4SCC=@0x46/*_BARCODE_RM4SCC*/ _BARCODE_DATAMATRIX=@0x47/*_BARCODE_DATAMATRIX*/ _BARCODE_EAN14=@0x48/*_BARCODE_EAN14*/ _BARCODE_VIN=@0x49/*_BARCODE_VIN*/ _BARCODE_CODABLOCKF=@0x4A/*_BARCODE_CODABLOCKF*/ _BARCODE_NVE18=@0x4B/*_BARCODE_NVE18*/ _BARCODE_JAPANPOST=@0x4C/*_BARCODE_JAPANPOST*/ _BARCODE_KOREAPOST=@0x4D/*_BARCODE_KOREAPOST*/ _BARCODE_RSS14STACK=@0x4F/*_BARCODE_RSS14STACK*/ _BARCODE_RSS14STACK_OMNI=@0x50/*_BARCODE_RSS14STACK_OMNI*/ _BARCODE_RSS_EXPSTACK=@0x51/*_BARCODE_RSS_EXPSTACK*/ _BARCODE_PLANET=@0x52/*_BARCODE_PLANET*/ _BARCODE_MICROPDF417=@0x54/*_BARCODE_MICROPDF417*/ _BARCODE_ONECODE=@0x55/*_BARCODE_ONECODE*/ _BARCODE_PLESSEY=@0x56/*_BARCODE_PLESSEY*/ _BARCODE_TELEPEN_NUM=@0x57/*_BARCODE_TELEPEN_NUM*/ _BARCODE_ITF14=@0x59/*_BARCODE_ITF14*/ _BARCODE_KIX=@0x5A/*_BARCODE_KIX*/ _BARCODE_AZTEC=@0x5C/*_BARCODE_AZTEC*/ _BARCODE_DAFT=@0x5D/*_BARCODE_DAFT*/ _BARCODE_MICROQR=@0x61/*_BARCODE_MICROQR*/ _BARCODE_HIBC_128=@0x62/*_BARCODE_HIBC_128*/ _BARCODE_HIBC_39=@0x63/*_BARCODE_HIBC_39*/ _BARCODE_HIBC_DM=@0x66/*_BARCODE_HIBC_DM*/ _BARCODE_HIBC_QR=@0x68/*_BARCODE_HIBC_QR*/ _BARCODE_HIBC_PDF=@0x6A/*_BARCODE_HIBC_PDF*/ _BARCODE_HIBC_MICPDF=@0x6C/*_BARCODE_HIBC_MICPDF*/ _BARCODE_HIBC_BLOCKF=@0x6E/*_BARCODE_HIBC_BLOCKF*/ _BARCODE_HIBC_AZTEC=@0x70/*_BARCODE_HIBC_AZTEC*/ _BARCODE_DOTCODE=@0x73/*_BARCODE_DOTCODE*/ _BARCODE_HANXIN=@0x74/*_BARCODE_HANXIN*/ _BARCODE_MAILMARK=@0x79/*_BARCODE_MAILMARK*/ _BARCODE_AZRUNE=@0x80/*_BARCODE_AZRUNE*/ _BARCODE_CODE32=@0x81/*_BARCODE_CODE32*/ _BARCODE_EANX_CC=@0x82/*_BARCODE_EANX_CC*/ _BARCODE_EAN128_CC=@0x83/*_BARCODE_EAN128_CC*/ _BARCODE_RSS14_CC=@0x84/*_BARCODE_RSS14_CC*/ _BARCODE_RSS_LTD_CC=@0x85/*_BARCODE_RSS_LTD_CC*/ _BARCODE_RSS_EXP_CC=@0x86/*_BARCODE_RSS_EXP_CC*/ _BARCODE_UPCA_CC=@0x87/*_BARCODE_UPCA_CC*/ _BARCODE_UPCE_CC=@0x88/*_BARCODE_UPCE_CC*/ _BARCODE_RSS14STACK_CC=@0x89/*_BARCODE_RSS14STACK_CC*/ _BARCODE_RSS14_OMNI_CC=@0x8A/*_BARCODE_RSS14_OMNI_CC*/ _BARCODE_RSS_EXPSTACK_CC=@0x8B/*_BARCODE_RSS_EXPSTACK_CC*/ _BARCODE_CHANNEL=@0x8C/*_BARCODE_CHANNEL*/ _BARCODE_CODEONE=@0x8D/*_BARCODE_CODEONE*/ _BARCODE_GRIDMATRIX=@0x8E/*_BARCODE_GRIDMATRIX*/ _BARCODE_UPNQR=@0x8F/*_BARCODE_UPNQR*/ _BARCODE_ULTRA=@0x90/*_BARCODE_ULTRA*/ _BARCODE_RMQR=@0x91/*_BARCODE_RMQR*/ end intellisense**/
如果有bug ,欢迎提出,或者分享修改后的代码, 谢谢.
登录后方可回帖
第二种方式: 直接调用dll函数
下面使用的是v230版本的dll , 用v270那个老是出错,估计dll找的不对, 有谁把那个源代码编译为v270版本dll的, 可以留言给我分享一份.
上面只是大概试了下保存文件, 还有很多函数需要测试, 以后测试了再更新.