2 Replies Latest reply on Jan 5, 2018 10:53 PM by Ermanno Mantovani

    dmPaperLength

    Ermanno Mantovani

      I can set dmPaperLength, copies etc. but how to set rw420 specific parameters from c++ programs ?

       

      Like journal or label mode , Speed and other parameters?

       

      Thanks

        • Re: dmPaperLength
          Steven Si

          All commands listed on ZPL Programming Guide that are applicable to RW420 can be sent to RW420 as a text string through program. These commands are usually referred to as SGD (Set-Get-Do) commands. We can use the following command to list all SGD related configuration variables from the RW420 printer

          ! U1 getvar "allcv"

          For example, we can send

          ! U1 setvar "media.type" "journal"

          to set the media to journal.

            • Re: dmPaperLength
              Ermanno Mantovani

              Thank you , but I need to set the zdesigner driver for windows 10 desktop

               

              Not to set the printer.

               

              My code is like this:

              ////////////////////////////////////////////////

              // SETUP PRINTER

              ///////////////////////////////////////////////

              OpenPrinter(szPrinterName, &hPrinter, NULL);

              if (!GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded))

              {

              if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)

              {

              ok = FALSE;

              return FALSE;

              }

              }

              prninfo = (PRINTER_INFO_2 *)malloc(dwNeeded);

              if (!(prninfo))

              {

              ok = FALSE;

              return FALSE;

              }

               

              if (!GetPrinter(hPrinter, 2,(LPBYTE)prninfo,dwNeeded,&dwPrintersR))

              {

              free(prninfo);

              prninfo = NULL;

              ok = FALSE;

              return FALSE;

              }

               

              DEVMODE *pDevMode = NULL;

              LONG lFlag;

              BOOL bFlag;

              short dmOrientation = 1;

               

              dwNeeded = DocumentProperties(NULL, hPrinter,szPrinterName,NULL, NULL, 0);

              if (dwNeeded <= 0)

              {

              GlobalFree(prninfo);

              ClosePrinter(hPrinter);

              return FALSE;

              }

               

              pDevMode = (DEVMODE *)GlobalAlloc(GPTR, dwNeeded);

              if (pDevMode == NULL)

              {

              GlobalFree(prninfo);

              ClosePrinter(hPrinter);

              return FALSE;

              }

               

              lFlag = DocumentProperties(NULL, hPrinter,szPrinterName,pDevMode, NULL,DM_OUT_BUFFER);

              if (lFlag != IDOK || pDevMode == NULL)

              {

              GlobalFree(pDevMode);

              free(prninfo);

              ClosePrinter(hPrinter);

              return FALSE;

              }

               

              prninfo->pDevMode = pDevMode;

               

              // Driver is reporting that it doesn't support this change...

              if (!(prninfo->pDevMode->dmFields & DM_ORIENTATION))

              {

              GlobalFree(prninfo);

              ClosePrinter(hPrinter);

              if (pDevMode)

              GlobalFree(pDevMode);

              return FALSE;

              }

               

              // Specify exactly what we are attempting to change...

              prninfo->pDevMode->dmFields = DM_ORIENTATION;

              prninfo->pDevMode->dmOrientation = dmOrientation;

               

              prninfo->pDevMode->dmFields = DM_PAPERLENGTH;

              prninfo->pDevMode->dmPaperLength = 2310;

              // Do not attempt to set security descriptor...

              prninfo->pSecurityDescriptor = NULL;

               

              // Make sure the driver-dependent part of devmode is updated...

              lFlag = DocumentProperties(NULL, hPrinter,szPrinterName,prninfo->pDevMode, prninfo->pDevMode,

              DM_IN_BUFFER | DM_OUT_BUFFER);

              if (lFlag != IDOK)

              {

              GlobalFree(prninfo);

              ClosePrinter(hPrinter);

              if (pDevMode)

              GlobalFree(pDevMode);

              return FALSE;

              }

               

              prninfo->pDevMode->dmFields = DM_PAPERWIDTH;

              prninfo->pDevMode->dmPaperWidth = 1000;

               

              // Do not attempt to set security descriptor...

              prninfo->pSecurityDescriptor = NULL;

               

              // Make sure the driver-dependent part of devmode is updated...

              lFlag = DocumentProperties(NULL, hPrinter,szPrinterName,prninfo->pDevMode, prninfo->pDevMode,

              DM_IN_BUFFER | DM_OUT_BUFFER);

              if (lFlag != IDOK)

              {

              GlobalFree(prninfo);

              ClosePrinter(hPrinter);

              if (pDevMode)

              GlobalFree(pDevMode);

              return FALSE;

              }

               

              prninfo->pDevMode->dmFields = DM_COPIES;

              prninfo->pDevMode->dmCopies = 3;

               

              // Do not attempt to set security descriptor...

              prninfo->pSecurityDescriptor = NULL;

               

              // Make sure the driver-dependent part of devmode is updated...

              lFlag = DocumentProperties(NULL, hPrinter,szPrinterName,prninfo->pDevMode, prninfo->pDevMode,

              DM_IN_BUFFER | DM_OUT_BUFFER);

              if (lFlag != IDOK)

              {

              GlobalFree(prninfo);

              ClosePrinter(hPrinter);

              if (pDevMode)

              GlobalFree(pDevMode);

              return FALSE;

              }

               

              // Update printer information...

              bFlag = SetPrinter(hPrinter, 2, (LPBYTE)prninfo, 0);

               

              // Tell other apps that there was a change...

              SendMessageTimeout(HWND_BROADCAST, WM_DEVMODECHANGE, 0L,

              (LPARAM)(LPCSTR)szPrinterName,

              SMTO_NORMAL, 1000, NULL);

               

              // Clean up...

              if (hPrinter)

              ClosePrinter(hPrinter);

              if (pDevMode)

              GlobalFree(pDevMode);

               

               

              This code set paper length , copies ,etc

               

              But how to set journal mode in zdesigner diriver ?