Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Info from print spool
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00104416
Message ID:
00104839
Views:
23
>Thanks George,
>
>I have a client who wants me to verify that a barcode I have printed actually has done so. This verication will then be used as part of database update.
>
>Could you pass on any information to me?
>
>Dale
Dale,

I haven't tested any of this. The pointers to the strings (members 2-7) of the JOB_INFO_1 structure are set to NULL here. I don't know what effect this will have. It might cause a GPF. So take care.
* Spooler API declarations
DECLARE OpenPrinter IN Winspool.drv;
  STRING @pPrinterName,;
  INTEGER @phPrinter, STRING @pDefault
DECLARE GetJob IN Winspool.drv;
  INTEGER hPrinter, INTEGER JobId,;
  INTEGER Level, STRING @pJob,;
  INTEGER cbBuf, INTEGER @pcbNeeded
DECLARE ClosePrinter IN Winspool.drv;
  INTEGER hPrinter
* Structure definintions
*typedef struct _JOB_INFO_1 {
*    DWORD  JobId;
*    LPTSTR pPrinterName;
*    LPTSTR pMachineName;
*    LPTSTR pUserName;
*    LPTSTR pDocument;
*    LPTSTR pDatatype;
*    LPTSTR pStatus;
*    DWORD  Status;
*    DWORD  Priority;
*    DWORD  Position;
*    DWORD  TotalPages;
*    DWORD  PagesPrinted;
*    SYSTEMTIME Submitted;
*} JOB_INFO_1;
*typedef struct _SYSTEMTIME {
*    WORD wYear;
*    WORD wMonth;
*    WORD wDayOfWeek;
*    WORD wDay;
*    WORD wHour;
*    WORD wMinute;
*    WORD wSecond;
*    WORD wMilliseconds;
*} SYSTEMTIME;
* Define a SYSTEMTIME structure
lcsystime = REPLICATE(CHR(0), 16)
* Define a JOB_INFO_1 structure
lcjobinfo = REPLICATE(CHR(0), 48) + lcsystime
lninfosize = LEN(lcjobinfo)
* Get the printer handle
* lcprinter is the name of the printer.
* Can be obtained from one of those printers
* listed in the first column of the array
* returned by APRINTERS()
STORE 0 TO lnhandle, lnbytes
* If the function succeeds llresult = .T.
* lnhandle will contain a handle to the printer
* object
llresult = OpenPrinter(@lcprinter, @lnhandle, 0)
IF llresult
  * Call GetJob
  * lnJobID is the ID
  * lnbytes will contain the number of bytes returned in the structure
  llresult = GetJob(lnhandle, lnJobID, 1, @lcjobinfo, lninfosize, @lnbytes)
  IF llresult
    * Bytes 45-48 will contain the number printed
    * Bytes 41-44 will contain the number submitted
    * Both in lo to hi byte format
  ENDIF
  = ClosePrinter(lnhandle)
ENDIF
I'd be interested in learning the results, either by post or email.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform