7 Replies Latest reply on Apr 8, 2016 11:41 AM by Gregory Pawlik

    Checking status of KR403 with winspool in Java

    Lukasz Byjos

      Hi. I have problem with checking status of zebra KR403 in Java. I'm trying to use winspool from jna but still geting status 0 for PRINTER_INFO_2.

       

          public static Winspool2.PRINTER_INFO_2 getPrinterInfo2(String printerName) {
              IntByReference pcbNeeded = new IntByReference();
              IntByReference pcReturned = new IntByReference();
              HANDLEByReference pHandle = new HANDLEByReference();
      
      
              Winspool2.INSTANCE.OpenPrinter(printerName, pHandle, null);
      
      
              Winspool2.INSTANCE.GetPrinter(pHandle.getValue(),
                      2,
                      null,
                      0,
                      pcbNeeded);
              if (pcbNeeded.getValue() <= 0) {
                  return new Winspool2.PRINTER_INFO_2();
              }
      
      
              Winspool2.PRINTER_INFO_2 pinfo2 = new Winspool2.PRINTER_INFO_2(pcbNeeded.getValue());
      
      
              Winspool2.INSTANCE.GetPrinter(pHandle.getValue(),
                      2, pinfo2.getPointer(),
                      pcbNeeded.getValue(),
                      pcReturned);
              pinfo2.read();
      
      
              return pinfo2;
          }