Search in sources :

Example 1 with JOB_INFO_1

use of com.sun.jna.platform.win32.Winspool.JOB_INFO_1 in project jna by java-native-access.

the class Win32SpoolMonitor method printJobInfo.

private void printJobInfo(JOB_INFO_1 jobInfo1) {
    FILETIME lpFileTime = new FILETIME();
    Kernel32.INSTANCE.SystemTimeToFileTime(jobInfo1.Submitted, lpFileTime);
    String info = "JobId: " + jobInfo1.JobId + "\n" + "pDatatype: " + jobInfo1.pDatatype + "\n" + "PagesPrinted: " + jobInfo1.PagesPrinted + "\n" + "pDocument: " + jobInfo1.pDocument + "\n" + "pMachineName: " + jobInfo1.pMachineName + "\n" + "Position: " + jobInfo1.Position + "\n" + "pPrinterName: " + jobInfo1.pPrinterName + "\n" + "Priority: " + jobInfo1.Priority + "\n" + "pStatus: " + jobInfo1.pStatus + "\n" + "pUserName: " + jobInfo1.pUserName + "\n" + "Status: " + jobInfo1.Status + "\n" + "TotalPages: " + jobInfo1.TotalPages + "\n" + "Submitted: " + DateFormat.getDateTimeInstance().format(lpFileTime.toDate());
    System.out.println(info);
}
Also used : FILETIME(com.sun.jna.platform.win32.WinBase.FILETIME)

Example 2 with JOB_INFO_1

use of com.sun.jna.platform.win32.Winspool.JOB_INFO_1 in project jna by java-native-access.

the class WinspoolUtil method getJobInfo1.

public static JOB_INFO_1[] getJobInfo1(HANDLEByReference phPrinter) {
    IntByReference pcbNeeded = new IntByReference();
    IntByReference pcReturned = new IntByReference();
    Winspool.INSTANCE.EnumJobs(phPrinter.getValue(), 0, 255, 1, null, 0, pcbNeeded, pcReturned);
    if (pcbNeeded.getValue() <= 0) {
        return new JOB_INFO_1[0];
    }
    JOB_INFO_1 pJobEnum = new JOB_INFO_1(pcbNeeded.getValue());
    if (!Winspool.INSTANCE.EnumJobs(phPrinter.getValue(), 0, 255, 1, pJobEnum.getPointer(), pcbNeeded.getValue(), pcbNeeded, pcReturned)) {
        throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
    }
    pJobEnum.read();
    return (JOB_INFO_1[]) pJobEnum.toArray(pcReturned.getValue());
}
Also used : IntByReference(com.sun.jna.ptr.IntByReference) JOB_INFO_1(com.sun.jna.platform.win32.Winspool.JOB_INFO_1)

Aggregations

FILETIME (com.sun.jna.platform.win32.WinBase.FILETIME)1 JOB_INFO_1 (com.sun.jna.platform.win32.Winspool.JOB_INFO_1)1 IntByReference (com.sun.jna.ptr.IntByReference)1