IonicWind Software

IWBasic => General Questions => Topic started by: John Dillon on April 02, 2007, 08:51:48 PM

Title: Cannot print to Network Printers
Post by: John Dillon on April 02, 2007, 08:51:48 PM
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

???
Title: Re: Cannot print to Network Printers
Post by: zdenekk on October 08, 2008, 01:59:15 AM
Try it by user with administrator privileges.
Title: Re: Cannot print to Network Printers
Post by: sapero on October 08, 2008, 05:27:06 AM
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.