I want to delete all Print Jobs from a print queue if a user decides to abort a print job. The following code to access the default printer works fine with the local printer connected to my machine. However, I get an error message ‘Access denied’ when my default printer is a network shared printer.
The code:
-----------------------------------------------------------------------
#DEFINE PRINTER_ACCESS_ADMINISTER 4
* Open a Pinter with proper access rights
lcPrDef = REPLICATE(CHR(0),8) + CHR(PRINTER_ACCESS_ADMINISTER) + REPLICATE(CHR(0),3)
lnOK = OpenPrinter( tcPrinterName, @lnHandle, lcPrDef
IF lnOK = 0 THEN
lcErrorTxt = ApiError()
WAIT WINDOW NOWAIT "Cannot Open Printer " + tcPrinterName + CHR(13) + lcErrorTxt
RETURN -1
ENDIF
----------------------------------------------------------------------------
Is there any way to get around this problem? Or how do I cancel printing from a network printer programmatically?
Thanks.
Abby Rosenstein
Figtree Consulting, Inc.