公司信息 解决方案 条码设备 条码耗材 工业设备 服务与支持 联系我们

 


您的位置:  敏用首页




SHINSEI JP2408应用程序编程实例

发布时间: 2011-2-23 19:48:13
双击自动滚屏打印此页】【关闭本页

SHINSEI JP2408采用C语言进行编程,可以实现现场条码数据采集、手动数据录入,然后即时打印标签的功能,下面是采用C语言编写的JP2408应用程序。
#include <stdio.h>
#include "share.h"
#define ROOT_LABELCOPY_FILE   "c:\labelcopy\"
#define PATH_LABELCOPY_FILE   "c:\labelcopy"
#define LABEL_PARA_FILE       "LabelPara.bin"
#define LABEL_TEST  "JOB NM=cmdprint,ID=1234
PAPER PG=%d,PW=%d,PH=%d
ENV MK=%d,TR=2,DR=1,SP=4,PS=%d,PO=0,TO=%d,CO=0,XO=0,YO=0,MD=1
START
BCD TP=%d,X=%d,Y=%d,DR=1,NW=%d,RA=%d,CD=%d,HT=%d,HR=1
%s
QTY P=%d
END
JOBE "
#define LABEL_FEED  "JOB NM=cmdprint,ID=1234
PAPER PG=%d,PW=%d,PH=%d
ENV MK=%d,TR=2,DR=1,SP=4,PS=%d,PO=0,TO=%d,CO=0,XO=0,YO=0,MD=1
START
QTY P=1
END
JOBE "
#define MAX_BARCODE_LEN_IN_SCANNER     20
#define _TEST_DEBUG_                   0

int iBarcodeType;
int iLocX;
int iLocY;
int iNW;
int iRatio;
int iCD;
int iBarcodeHeight;
int iLabelType;
int iPositionStop;
int iPositionTrim;
int iPageHeight;
int iPageWidth;
int iPageGap;
int iLabelPages;
void LabelCopy(void);
void SetPrintPages(void);
BOOL SetLabelParameter(void);
void SetLabelDefaultParameter(void);
void UserInitProject(void)
{
    uint uiKeyRet;
    char sFile[MAX_PATH_LEN],sParaTemp[100];
    uchar sPageGap[2 + 1],sPageHeight[4 + 1],sPageWidth[3 + 1],sLabelType[2 + 1],sPS[4 + 1],sTO[3 + 1];
    char *pRecord;
    FILE *fp;
    ST_DIR *pDir;
    unsigned long ulWriteLength;
    memset(sFile,0,sizeof(sFile));
    memset(sParaTemp,0,sizeof(sParaTemp));
    //程序名称及版本信息
    Lcd_Show_String((uchar *)"****************",0 * 16,0 * 8);
    Lcd_Show_String((uchar *)"   JP2408 App   ",1 * 16,0 * 8);                            
    Lcd_Show_String((uchar *)"      V1.20     ",2 * 16,0 * 8);                            
    Lcd_Show_String((uchar *)"****************",3 * 16,0 * 8);
    DelayMSByTimer2(300);
    strcpy(sFile,LABEL_PARA_FILE);
    CopyPathToFilename(sFile,ROOT_LABELCOPY_FILE);
    if (NULL == (pDir = opendir(PATH_LABELCOPY_FILE)))
    {// 创建该目录 
        if (mkdir(PATH_LABELCOPY_FILE))
     {
            while (1)
      {
                MessageBox("系统目录创建失败,请重启!",MSG_TYPE_ERROR,NULL);
      }
     }
    }
    else  closedir(pDir);
    if ((fp = fopen(sFile,"r")) == NULL)
    {//保存参数设置的文件丢失
        fclose(fp);
        SetLabelDefaultParameter();
        fp = fopen(sFile,"w+");
        sprintf(sParaTemp,"%d,%d,%d,%d,%d,%d ",iPageGap,iPageWidth,iPageHeight,iLabelType,iPositionStop,iPositionTrim);
        fwrite(sParaTemp,1,strlen(sParaTemp),fp);
    }
    memset(sParaTemp,0,sizeof(sParaTemp));
    fseek(fp,0,SEEK_SET);
    pRecord = fgets(sParaTemp,100,fp);
    fclose(fp);
    pRecord = GetSectionOfCSVRecord((char *)sPageGap,pRecord,2);
    iPageGap = atoi(sPageGap);
    pRecord = GetSectionOfCSVRecord((char *)sPageWidth,pRecord,3);
    iPageWidth = atoi(sPageWidth);
    pRecord = GetSectionOfCSVRecord((char *)sPageHeight,pRecord,4);
    iPageHeight = atoi(sPageHeight);
    pRecord = GetSectionOfCSVRecord((char *)sLabelType,pRecord,2);
    iLabelType = atoi(sLabelType);
    pRecord = GetSectionOfCSVRecord((char *)sPS,pRecord,4);
    iPositionStop = atoi(sPS);
    pRecord = GetSectionOfCSVRecord((char *)sTO,pRecord,3);
    iPositionTrim = atoi(sTO);
    iBarcodeType = 8;
    iLocX = 10;
    iLocY = 10;
    iNW = 2;
    iRatio = 2;
    iCD = 0;
    iBarcodeHeight = 80;
    iLabelPages = 1;
    BuzzerOK();
}
void SetLabelDefaultParameter(void)
{
    iBarcodeType = 8;
    iLocX = 10;
    iLocY = 10;
    iNW = 2;
    iRatio = 2;
    iCD = 0;
    iBarcodeHeight = 80;
    iLabelType = 1;
    iPositionTrim = 0;
    iPositionStop = 0;
    iPageHeight = 344;
    iPageWidth = 440;
    iPageGap = 0;
    iLabelPages = 1;
}
/******************************************************
            应用程序入口
*******************************************************/           
void App_Main(void)
{
    InitApplication();
    while (1)
    {
        LabelCopy();
    } 
}
void LabelCopy(void)
{
    char sScannerString[MAX_BARCODE_LEN_IN_SCANNER + 1],sCodeVal[MAX_BARCODE_LEN + 1];
    INPUT_PARA tInputPara;
    BARCODE tBarcodeInfo;
    uint uiWidth;
    uint uiMsgRet;
    char sPrintCmdBuf[CMD_BUF + 1],sConstString[16 + 1];
    uchar bKeyChar;
    const char *pMsgSelect[] = {"确定 ","取消 ",NULL};
    ClearLCDLines(1,4);
    memset(sScannerString,0,sizeof(sScannerString));
    memset(&tInputPara,0,sizeof(INPUT_PARA));
    memset(&tBarcodeInfo,0,sizeof(BARCODE));
    tInputPara.bDefaultIM = IM_NUMBER;
    tInputPara.bIMChangeDisable = 1;
    tInputPara.iInputMode = TYPEMODE_KEYPAD_AND_SCANER;
    tInputPara.iLCDDisplayArea = 16;
    tInputPara.iMaxInputLen = MAX_BARCODE_LEN_IN_SCANNER;
    tInputPara.pBuf = (uchar *)sScannerString;
    tInputPara.uiEnableKeys = KEY_P|KEY_E;
    tInputPara.x = 2;
    tInputPara.y = 0;
    tBarcodeInfo.iCD = iCD;
    tBarcodeInfo.iHeight = iBarcodeHeight;
    tBarcodeInfo.iHRIPosition = HRI_POS_BOTTOM ;
    tBarcodeInfo.iRotate = ROTATE_0 ;
    tBarcodeInfo.iModuleWidth = iNW;
    tBarcodeInfo.iRatio = iRatio;
    while (1)
    {
        LcdShowString(1,1,"    扫描打印    ");
        LcdShowString(2,1,"[F1]打印张数    ");
        LcdShowString(3,1,"[F4]参数设置    ");
        LcdShowString(4,1,"[E]进入扫描     ");
        if (kbhit())
     {
            bKeyChar = kbgetchar();
            BuzzerOK();
            if ('E' == bKeyChar) break;
            else if ('P' == bKeyChar) return;
            else if ('S' == bKeyChar)
            {//隐藏菜单 
                DelayMSByTimer2(500);
                if ('S' == kbgetchar())
          {
                 UsbDisk();
                 continue;
          }
      }
         else
      {
                switch(bKeyChar)
          {
                case 11://key_F1
                    SetPrintPages();
              break;
                case 14://key_F4
                    if (!SetLabelParameter()) return;
              break;
                case 'F'://走纸 
                    memset(sPrintCmdBuf,0,sizeof(sPrintCmdBuf));
                    sprintf(sPrintCmdBuf,LABEL_FEED,iPageGap,iPageWidth,iPageHeight,iLabelType,iPositionStop,iPositionTrim);
                    SendPrintCmd(sPrintCmdBuf);
              break;
             default:
                    BuzzerError();
              break;
          }
      }
     }
    }
    while (1)
    {
        LcdShowString(2,1,"扫描条码......  ");
        LcdShowString(3,1,"                ");
        LcdShowString(4,1,"                ");
   
        tBarcodeInfo.iType = iBarcodeType = InputFromScanner(&tInputPara);
        if (0 == iBarcodeType )
     {
            MessageBox("不支持的条码!!",MSG_TYPE_INFORMATION,NULL);
            break;
     }
        else if (-1 == iBarcodeType)
     {
            uiMsgRet = MessageBox("确定退出? ",MSG_TYPE_QUESTION,pMsgSelect);
            if (1 == uiMsgRet) break;
            else continue;
     }
        memset(sCodeVal,0,sizeof(sCodeVal));
        strcpy(sCodeVal,(char *)tInputPara.pBuf);
        if (iBarcodeType == BARCODE_CODE128)
     {
            tBarcodeInfo.iCD = iCD = 1;//add for 05T1-001
            Code128AutoSelectCodeSet(sCodeVal);
     }
        if (iBarcodeType == BARCODE_NW7)//增加起始终止符A,本体只支持ABCD类型 
     {
            memmove(sCodeVal + 1,sCodeVal,strlen(sCodeVal));
            sCodeVal[0] = 'A';//起始符 
            strcat(sCodeVal,"A");
     }
        for (iNW = 3;iNW > 0;iNW--)
     {
            tBarcodeInfo.iModuleWidth = iNW;
            if ((iBarcodeType == BARCODE_ITF||(iBarcodeType == BARCODE_NW7)||(iBarcodeType == BARCODE_CODE39)))
      {
                for (iRatio = 6;iRatio > 0;iRatio--)
          {
                    tBarcodeInfo.iRatio = iRatio;
                    uiWidth = GetBarcodePrintWidth(&tBarcodeInfo,sCodeVal);
                    if (0 == uiWidth)
           {
                        MessageBox("错误的条码!!",MSG_TYPE_INFORMATION,NULL);
                  return;
           }
                    if (uiWidth > (iPageWidth - 6*8)) continue;//预留左右边距3MM
                    else goto SetLocation;//找到最大可用条码宽度 
          }
                continue;
      }
            tBarcodeInfo.iRatio = iRatio = 2;
            uiWidth = GetBarcodePrintWidth(&tBarcodeInfo,sCodeVal);
            if (0 == uiWidth)
      {
                MessageBox("错误的条码!!",MSG_TYPE_INFORMATION,NULL);
             return;
      }
            if (uiWidth > (iPageWidth - 6*8)) continue;//预留左右边距3MM 
            else goto SetLocation;
     }
        MessageBox("条码宽度超出打印范围!! ",MSG_TYPE_INFORMATION,NULL); break;
SetLocation:
        iBarcodeHeight = iPageHeight - 2*5*8;//预留上下边距5MM 
        if (HRI_POS_BOTTOM == tBarcodeInfo.iHRIPosition)//HRI在条码下面时的打印位置调整 
     {
            if (BARCODE_UPCE == iBarcodeType||BARCODE_UPCA == iBarcodeType||BARCODE_EAN13 == iBarcodeType)
      {
                iLocX = (iPageWidth - uiWidth)/2 - (16 + 4);//200点打印默认采用16点黑体,间隔4点 
      }
            else iLocX = (iPageWidth - uiWidth)/2;
     }
        else  iLocX = (iPageWidth - uiWidth)/2;
     
        //校正打印条码实际高度,增加HRI高度调整值16 + 4
        iLocY = (iPageHeight - iBarcodeHeight - (16 + 4))/2;
        memset(sPrintCmdBuf,0,sizeof(sPrintCmdBuf));
        sprintf(sPrintCmdBuf,LABEL_TEST,iPageGap,iPageWidth,iPageHeight,iLabelType,iPositionStop,iPositionTrim
            ,iBarcodeType,iLocX,iLocY,iNW,iRatio,iCD,iBarcodeHeight,sCodeVal,iLabelPages);
#if _TEST_DEBUG_
        jp_printf("cmdbuf= %s ",sPrintCmdBuf);
#endif
        if (!SendPrintCmd(sPrintCmdBuf)) return;
    }
}
void SetPrintPages(void)
{
    ClearLCDLines(1,4);
    InputPage(&iLabelPages,KEY_E|KEY_P);
}
static BOOL SubMenuSetLabelSize(void)
{
    uint uiKeyRet,uiMsgRet;
    char sFile[MAX_PATH_LEN],sParaTemp[100];
    uchar sPageGap[2 + 1],sPageHeight[2 + 1],sPageWidth[2 + 1];
    FILE *fp;
    unsigned long ulWriteLength;
    INPUT_PARA tInputPara;
    const char *pMsgSelect[] = {"确定 ","取消 ",NULL};
    memset(sFile,0,sizeof(sFile));
    memset(sParaTemp,0,sizeof(sParaTemp));
    memset(&tInputPara,0,sizeof(INPUT_PARA));
    memset(sPageGap,0,sizeof(sPageGap));
    fs_itoa(iPageGap/8,(char *)sPageGap,10);
    memset(sPageHeight,0,sizeof(sPageHeight));
    fs_itoa(iPageHeight/8,(char *)sPageHeight,10);
    memset(sPageWidth,0,sizeof(sPageWidth));
    fs_itoa(iPageWidth/8,(char *)sPageWidth,10);
    strcpy(sFile,LABEL_PARA_FILE);
    CopyPathToFilename(sFile,ROOT_LABELCOPY_FILE);
    ClearLCDLines(1,4);
    LcdShowString(1,1,"标签大小设置  ");
    LcdShowString(2,1,"间隔:[  ]mm   ");
    LcdShowString(3,1,"宽度:[  ]mm   ");
    LcdShowString(4,1,"高度:[  ]mm   ");
    LcdShowString(2,7,(char *)sPageGap);
    LcdShowString(3,7,(char *)sPageWidth);
    LcdShowString(4,7,(char *)sPageHeight);
    while (1)
    {
        tInputPara.bDefaultIM = IM_NUMBER;
        tInputPara.bIMChangeDisable = 1;
        tInputPara.iInputMode = TYPEMODE_KEYPAD;
        tInputPara.iLCDDisplayArea = 2;
        tInputPara.iMaxInputLen = 2;
        tInputPara.pBuf = sPageGap;
        tInputPara.uiEnableKeys = KEY_E|KEY_P|KEY_DOWN;
        tInputPara.x = 1;
        tInputPara.y = 6;
        uiKeyRet = InputNumber(&tInputPara);
        if (0 == strlen(sPageGap)) LcdShowString(2,7,"0");
        iPageGap = atoi(sPageGap) * 8;//单位换算mm - dot 
        if (iPageGap < 0||iPageGap > 80)
     {
            MessageBox("标签间隔只能在0--10之间 ",MSG_TYPE_INFORMATION,NULL);
            continue;
     }
        if (KEY_P == uiKeyRet)
     {
            uiMsgRet = MessageBox("确定退出? ",MSG_TYPE_QUESTION,pMsgSelect);
            if (1 == uiMsgRet) goto exit;
            else continue;
     }
        while (1)
     {
            tInputPara.pBuf = sPageWidth;
            tInputPara.uiEnableKeys = KEY_E|KEY_P|KEY_DOWN|KEY_UP;
            tInputPara.x = 2;
            tInputPara.y = 6;
            uiKeyRet = InputNumber(&tInputPara);
            iPageWidth = atoi(sPageWidth) * 8;
            if (iPageWidth < 192||iPageWidth > 448)
      {
                MessageBox("标签宽度只能在24--56之间 ",MSG_TYPE_INFORMATION,NULL);
                continue;
      }
            if (KEY_P == uiKeyRet)
      {
                uiMsgRet = MessageBox("确定退出? ",MSG_TYPE_QUESTION,pMsgSelect);
                if (1 == uiMsgRet) goto exit;
                else continue;
      }
            else if (KEY_UP == uiKeyRet) break;
            while (1)
      {
                tInputPara.pBuf = sPageHeight;
                tInputPara.uiEnableKeys = KEY_E|KEY_P|KEY_UP;
                tInputPara.x = 3;
                tInputPara.y = 6;
                uiKeyRet = InputNumber(&tInputPara);
                iPageHeight = atoi(sPageHeight) * 8;
                if (iPageHeight < 80||iPageHeight > 792)
          {
                    MessageBox("标签高度只能在10--99之间 ",MSG_TYPE_INFORMATION,NULL);
                 continue;
          }
                if (KEY_P == uiKeyRet)
          {
                    uiMsgRet = MessageBox("确定退出? ",MSG_TYPE_QUESTION,pMsgSelect);
                    if (1 == uiMsgRet) goto exit;
                    else continue;
          }
                else if (KEY_UP == uiKeyRet) break;
                else if (KEY_E == uiKeyRet) goto exit;
      }
     }
    }
exit:
    fp = fopen(sFile,"r+");
    sprintf(sParaTemp,"%d,%d,%d,%d,%d,%d ",iPageGap,iPageWidth,iPageHeight,iLabelType,iPositionStop,iPositionTrim);
    ulWriteLength = fwrite(sParaTemp,1,strlen(sParaTemp),fp);
    if (ulWriteLength < strlen(sParaTemp))
    {
        MessageBox("标签格式保存失败!!",MSG_TYPE_INFORMATION,NULL);
        fclose(fp);
        return FALSE;
    }
    fclose(fp);
    return TRUE;
}
static BOOL SubMemuSetLabelType(void)
{
    char sFile[MAX_PATH_LEN],sParaTemp[100];
    uchar bGetChar;
    unsigned long ulWriteLength;
    FILE *fp;
    ClearLCDLines(1,4);
    memset(sFile,0,sizeof(sFile));
    strcpy(sFile,LABEL_PARA_FILE);
    CopyPathToFilename(sFile,ROOT_LABELCOPY_FILE);
    LcdShowString(1,1,"选择标签类型 ");
    LcdShowString(2,1,"  黑标连续  ");
    LcdDefImgBox(16,8 * 4);
    if (1 == iLabelType) LcdRvsImgBox(1 * 16,2 * 8);//反显黒标纸  
    else LcdRvsImgBox(1 * 16,7 * 8);//否则,连续纸 
    while (1)
    {
        if (kbhit())
     {
            bGetChar = kbgetchar();
            BuzzerOK();
            if ('E' == bGetChar) break;
            else if (20 == bGetChar||21 == bGetChar)//左右方向键 
      {
                if (1 == iLabelType)
          {
                    iLabelType = 3;
                    LcdRvsImgBox(1 * 16,2 * 8);
                    LcdRvsImgBox(1 * 16,7 * 8);
          }
          else
          {
                    iLabelType = 1;
                    LcdRvsImgBox(1 * 16,7 * 8);
                    LcdRvsImgBox(1 * 16,2 * 8);
          }
      }
            else BuzzerError();
     }
    }
    fp = fopen(sFile,"r+");
    sprintf(sParaTemp,"%d,%d,%d,%d,%d,%d ",iPageGap,iPageWidth,iPageHeight,iLabelType,iPositionStop,iPositionTrim);
    ulWriteLength = fwrite(sParaTemp,1,strlen(sParaTemp),fp);
    if (ulWriteLength < strlen(sParaTemp))
    {
        MessageBox("标签格式保存失败!!",MSG_TYPE_INFORMATION,NULL);
        fclose(fp);
        return FALSE;
    }
    fclose(fp);
    return TRUE;
}
static BOOL SubMenuSetPS(void)
{
    uint uiKeyRet,uiMsgRet;
    char sFile[MAX_PATH_LEN],sParaTemp[100];
    uchar sPositionStop[4 + 1];
    FILE *fp;
    unsigned long ulWriteLength;
    INPUT_PARA tInputPara;
    const char *pMsgSelect[] = {"确定 ","取消 ",NULL};
    memset(sFile,0,sizeof(sFile));
    memset(sParaTemp,0,sizeof(sParaTemp));
    memset(&tInputPara,0,sizeof(INPUT_PARA));
    memset(sPositionStop,0,sizeof(sPositionStop));
    fs_itoa(iPositionStop,(char *)sPositionStop,10);

    strcpy(sFile,LABEL_PARA_FILE);
    CopyPathToFilename(sFile,ROOT_LABELCOPY_FILE);
    ClearLCDLines(1,4);
    LcdShowString(1,1,"停止位置设置  ");
    LcdShowString(2,1,"设定值:[    ] ");
    LcdShowString(3,1,"单位:dot      ");
    LcdShowString(2,9,(char *)sPositionStop);

    while (1)
    {
        tInputPara.bDefaultIM = IM_NUMBER;
        tInputPara.bIMChangeDisable = 1;
        tInputPara.iInputMode = TYPEMODE_KEYPAD;
        tInputPara.iLCDDisplayArea = 4;
        tInputPara.iMaxInputLen = 4;
        tInputPara.pBuf = sPositionStop;
        tInputPara.uiEnableKeys = KEY_E|KEY_P;
        tInputPara.x = 1;
        tInputPara.y = 8;
        uiKeyRet = InputNumber(&tInputPara);
        if (0 == strlen(sPositionStop)) LcdShowString(2,9,"0");
        iPositionStop = atoi(sPositionStop);
        if (iPositionStop < 0||iPositionStop > 3200)
     {
            MessageBox("停止位置只能在0--3200之间 ",MSG_TYPE_INFORMATION,NULL);
            continue;
     }
        if (KEY_P == uiKeyRet)
     {
            uiMsgRet = MessageBox("确定退出? ",MSG_TYPE_QUESTION,pMsgSelect);
            if (1 == uiMsgRet) break;
            else continue;
     }
        else if (KEY_E == uiKeyRet) break;
    }
    fp = fopen(sFile,"r+");
    sprintf(sParaTemp,"%d,%d,%d,%d,%d,%d ",iPageGap,iPageWidth,iPageHeight,iLabelType,iPositionStop,iPositionTrim);
    ulWriteLength = fwrite(sParaTemp,1,strlen(sParaTemp),fp);
    if (ulWriteLength < strlen(sParaTemp))
    {
        MessageBox("标签格式保存失败!!",MSG_TYPE_INFORMATION,NULL);
        fclose(fp);
        return FALSE;
    }
    fclose(fp);
    return TRUE;
}
static BOOL SubMenuSetTO(void)
{
    uint uiKeyRet,uiMsgRet;
    char sFile[MAX_PATH_LEN],sParaTemp[100];
    uchar sPositionTrim[4 + 1];
    FILE *fp;
    unsigned long ulWriteLength;
    INPUT_PARA tInputPara;
    const char *pMsgSelect[] = {"确定 ","取消 ",NULL};
    memset(sFile,0,sizeof(sFile));
    memset(sParaTemp,0,sizeof(sParaTemp));
    memset(&tInputPara,0,sizeof(INPUT_PARA));
    memset(sPositionTrim,0,sizeof(sPositionTrim));
    fs_itoa(iPositionTrim,(char *)sPositionTrim,10);

    strcpy(sFile,LABEL_PARA_FILE);
    CopyPathToFilename(sFile,ROOT_LABELCOPY_FILE);
    ClearLCDLines(1,4);
    LcdShowString(1,1,"送纸量设置    ");
    LcdShowString(2,1,"设定值:[    ] ");
    LcdShowString(3,1,"单位:dot      ");
    LcdShowString(2,9,(char *)sPositionTrim);

    while (1)
    {
        tInputPara.bDefaultIM = IM_NUMBER;
        tInputPara.bIMChangeDisable = 1;
        tInputPara.iInputMode = TYPEMODE_KEYPAD;
        tInputPara.iLCDDisplayArea = 3;
        tInputPara.iMaxInputLen = 3;
        tInputPara.pBuf = sPositionTrim;
        tInputPara.uiEnableKeys = KEY_E|KEY_P;
        tInputPara.x = 1;
        tInputPara.y = 8;
        uiKeyRet = InputNumber(&tInputPara);
        if (0 == strlen(sPositionTrim)) LcdShowString(2,9,"0");
        iPositionTrim = atoi(sPositionTrim);
        if (iPositionTrim < 0||iPositionTrim > 100)
     {
            MessageBox("送纸量只能在0--100之间 ",MSG_TYPE_INFORMATION,NULL);
            continue;
     }
        if (KEY_P == uiKeyRet)
     {
            uiMsgRet = MessageBox("确定退出? ",MSG_TYPE_QUESTION,pMsgSelect);
            if (1 == uiMsgRet) break;
            else continue;
     }
        if (KEY_E == uiKeyRet) break;
    }
    fp = fopen(sFile,"r+");
    sprintf(sParaTemp,"%d,%d,%d,%d,%d,%d ",iPageGap,iPageWidth,iPageHeight,iLabelType,iPositionStop,iPositionTrim);
    ulWriteLength = fwrite(sParaTemp,1,strlen(sParaTemp),fp);
    if (ulWriteLength < strlen(sParaTemp))
    {
        MessageBox("标签格式保存失败!!",MSG_TYPE_INFORMATION,NULL);
        fclose(fp);
        return FALSE;
    }
    fclose(fp);
    return TRUE;
}
BOOL SetLabelParameter(void)
{
    uint uiRetKey;
    MENU_PARA tMenuPara;
    const char *pString[] = {
        "标签尺寸  ",
        "标签类型  ",
        "停止位置  ",
        "送纸量    ",
        NULL
    };
    memset(&tMenuPara,0,sizeof(MENU_PARA));
    tMenuPara.iCurrentItem = 0;
    tMenuPara.pMenuStr = pString;
    tMenuPara.pTitle = NULL;
    tMenuPara.uiEnableKeys = KEY_P;
    while (1)
    {
        uiRetKey = ShowMenu(&tMenuPara);
        if (KEY_P == uiRetKey) break;
        switch(tMenuPara.iCurrentItem)
     {
        case 0:
            if (!SubMenuSetLabelSize()) return FALSE;
            break;
        case 1:
            if (!SubMemuSetLabelType()) return FALSE;
            break;
        case 2:
            if (!SubMenuSetPS()) return FALSE;
            break;
        case 3:
            if (!SubMenuSetTO()) return FALSE;
            break;
        default:
            break;
     } 
    } 
    return TRUE;
}

 


相关同类信息:
  • Citizen CLP631对热缩管进行打印时的几点注意
  • 为什么zebra s4m打印机打出来的字体边缘模糊?
  • TSC ttp247在使用中红灯报警处理方法
  • SATO CG408/CG208/CG412/CG212恢复出厂值的方法
  • Citizen CLP-621&631机器故障解决方法
  • Zebra S4M多次重装碳带和标签,仍报警
  • TSC TTP244plus报警而不能打印,如何解决?
  • SATO CL412E打印机,Ribbon end是怎么回事?

  •  
    © 2003-2007 ChongShang.Com.Cn.