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);
}
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());
}
Aggregations