October 31, 2025, 04:56:27 AM

News:

IWBasic runs in Windows 11!


Cannot print to Network Printers

Started by John Dillon, April 02, 2007, 08:51:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

John Dillon

April 02, 2007, 08:51:48 PM Last Edit: April 13, 2007, 08:17:21 PM by John Dillon
My coding and learning experiments have included spin-off utilities. One utility requires a text print (current OS in all circumstances has been Windows XP Pro). This routine writes successfully to local printers and even to a LAN printer in my home â€ââ,¬Å" Brother 5240DN with no problems. I do have a networked USB printer â€ââ,¬Å" HP1220C that fails to print and causes my program to CRASH â€ââ,¬Å" Message from windows that closes the programs and asks to send a report.
At work I am printing to Network (Served) printers with printer names returned like â€Ã...“\\BHTIPSRV87\PRN0801120â€Ã, for a printer. OPENPRINTER always returns a 0.
What can I do to get this working?
************************************************************************
'                        Send Buffer to the Printer
' ************************************************************************
'
SUB out_to_printer

if Buffer$ <> ""

printer = PRTDIALOG(win,startpg,endpg,copies,collate)
Printer_Num = OPENPRINTER(printer,"VAV-Parameters","TEXT")

if(Printer_Num)
WRITEPRINTER Printer_Num,Buffer$
CLOSEPRINTER Printer_Num
endif

endif

return
ENDSUB

???

zdenekk

Try it by user with administrator privileges.

sapero

October 08, 2008, 05:27:06 AM #2 Last Edit: October 08, 2008, 05:28:40 AM by sapero
As zdenekk said, you need to call OPENPRINTER as user with administrative privileges, because the current version of OPENPRINTER is requesting administrative access rights: DELETE, WRITE_DAC and WRITE_OWNER. These flags are ignored on Windows 95/98/Me.