Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Some API to printer management
Message
From
02/11/1998 07:53:36
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00152621
Message ID:
00153427
Views:
30
>>Hi all!
>>
>>I want to get some tools wich could give me a possibility to define printer errors (such as paper out, too long wait time, buffer overflawing etc.) from VFP programmatically.
>>
>>I've tried to find something like this in Win32API help, but that attempts was not successful.
>>
>>Maybe You know some API functions or similar ways (ActiveX, classes, OLE suggestions etc.) for that, or some place where I can find information about theese ways?
>>
>>Sorry for bad English.
>>
>Hi Dmitry,
>I don't know if the following will help. I tried this with the printer off and the printer on and out of paper and the value displayed was 0. I have a feeling that this information *may* be returned if it's issued directly after an attempt to print, but haven't tested it. Anyway, here's the code and the declares for what the status might be:
>DECLARE SHORT OpenPrinter IN Winspool.drv;
>  STRING @pPrinterName,	INTEGER @phPrinter,;
>  STRING @pDefault
>DECLARE SHORT ClosePrinter IN Winspool.drv;
>  INTEGER hPrinter
>DECLARE SHORT GetPrinter IN Winspool.drv AS GetPrinterInfo;
>  INTEGER hPrinter, INTEGER Level,;
>  STRING @pPrinter, INTEGER cbBuf,;
>  INTEGER @pcbNeeded
>lcprinter = 'LPT1:'
>lnhandle = 0
>llresult = (OpenPrinter(@lcprinter, @lnhandle, 0) # 0)
>IF llresult
>  lnsize = 0
>  = GetPrinterInfo(lnhandle, 2, 0, 0, @lnsize)
>  lcstruct = REPLICATE(CHR(0), lnsize)
>  llresult = (GetPrinterInfo(lnhandle, 2, @lcstruct, lnsize, @lnsize) # 0)
>  IF llresult
>    lcstatus = SUBSTR(lcstruct, 73, 4)
>    lnstatus = 0
>    FOR lni = 1 TO 4
>      lnstatus = lnstatus + ASC(SUBSTR(lcstatus, lni, 1)) * (256 ^ (lni - 1))
>    NEXT
>    ? lnstatus
>  ENDIF
>  = ClosePrinter(lnhandle)
>ENDIF
>* Printer status codes returned by Win95/98
>#define PRINTER_STATUS_PAUSED            0x00000001
>#define PRINTER_STATUS_ERROR             0x00000002
>#define PRINTER_STATUS_PENDING_DELETION  0x00000004
>#define PRINTER_STATUS_PAPER_JAM         0x00000008
>#define PRINTER_STATUS_PAPER_OUT         0x00000010
>#define PRINTER_STATUS_MANUAL_FEED       0x00000020
>#define PRINTER_STATUS_PAPER_PROBLEM     0x00000040
>#define PRINTER_STATUS_OFFLINE           0x00000080
>#define PRINTER_STATUS_IO_ACTIVE         0x00000100
>#define PRINTER_STATUS_BUSY              0x00000200
>#define PRINTER_STATUS_PRINTING          0x00000400
>#define PRINTER_STATUS_OUTPUT_BIN_FULL   0x00000800
>#define PRINTER_STATUS_NOT_AVAILABLE     0x00001000
>#define PRINTER_STATUS_WAITING           0x00002000
>#define PRINTER_STATUS_PROCESSING        0x00004000
>#define PRINTER_STATUS_INITIALIZING      0x00008000
>#define PRINTER_STATUS_WARMING_UP        0x00010000
>#define PRINTER_STATUS_TONER_LOW         0x00020000
>#define PRINTER_STATUS_NO_TONER          0x00040000
>#define PRINTER_STATUS_PAGE_PUNT         0x00080000
>#define PRINTER_STATUS_USER_INTERVENTION 0x00100000
>#define PRINTER_STATUS_OUT_OF_MEMORY     0x00200000
>#define PRINTER_STATUS_DOOR_OPEN         0x00400000
>#define PRINTER_STATUS_SERVER_UNKNOWN    0x00800000
>#define PRINTER_STATUS_POWER_SAVE        0x01000000
>hth,


George,

A friend of mine is using API to control remote printers over the web and he cannot find one that allows him to cancel a job in the que of a printer. Do you know of any?

Thanks, Renoir
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform