Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When set printer to name selectedpriner does not work
Message
From
24/06/2003 03:37:50
 
 
To
24/06/2003 00:32:22
Vladimir Zhuravlev
Institute of the Physics of Earth,Russia
Moscow Region, Russia
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00803155
Message ID:
00803176
Views:
15
>We have very starnge situation
>We have printer form which works for meny years in many our projects ( exe).
>It permits to select printer , copies numbers, pages, to send report to the printer or screen, modify report etc
>Two weeks ago one of our clients said , he can not to choose printer any more
>He selects printer ( not default), click print and reports goes to the default printer on the net.
>We deleted info about the printer from frx ( first record) and in this case program shows like it print reports ( small window with frx proccesing) and no printing anywhere.
>The comand for printing is regular
>set printer to name selectedprinter
>report form ... noconsole to printer
>To eliminate some unknown bugs in the form I came to client myself, temporaly installed VFP , used command window and tried to send report to selected printer by
>set printer to getprinter()
>report form ... noconsole to printer
>And... same situation
>I checked set('printer',3) and it has shown the right selected printer , not default one
>The reports goes to default printer or to nowhere
>All printers are at net computers, but just if printer is on your own computer
>it is same situation
>The only one thin was changed in this company, server computer has windows XP instead of 98.
>I deinstalled VFP there and don't know , what to do now.
>This form works ok for us, and for the rest of our clients.
>Where could be the reason of this behaviour?
>Thanks in advance , Vladimir

Vladimir,

I believe you are experiencing what I have described in message#789331.

Since you have a printer form, you have only one place to change anything ( I have the 'REPORT FORM ..PROMPT' scattered all over the app)

Can you try the following (this will reset the default windows printer temporarily)
Instead of
set printer to name (SomePrinterName)
use
&& printing
local sPrint, NewPrinter

NewPrinter = GetPrinter() && or something else
=Printer_Set(NewPrinter, @sPrint)
=_fpReset()
report form (NameOfYourReport) NOCONSOLE To Printer
=_fpReset()
=Printer_Set(sPrint)

*-------------------------------------------------------------------------------
function Printer_Get()
	return WindowsPrinter_Get()
endfunc
*-------------------------------------------------------------------------------
function Printer_Set(PrinterNew, PrinterOld)
	=WindowsPrinter_Set(PrinterNew, @PrinterOld)
endfunc
*-------------------------------------------------------------------------------
function	WindowsPrinter_Get()
	return set('Printer', 2)
endfunc
*-------------------------------------------------------------------------------
function	WindowsPrinter_Set(PrinterNew, PrinterOld)
	
	local wsh, sError
	sError = on('error')
	PrinterOld = WindowsPrinter_Get()
	do case
	case lower(PrinterOld) <> lower(PrinterNew)
		wsh = CreateObject('WScript.Network')
		private HadError
		HadError = FALSE
		on error HadError = TRUE
		wsh.SetDefaultPrinter(PrinterNew)
		on error &sError
		wsh = Null
		return !HadError
	endcase
endfunc
*-------------------------------------------------------------------------------
Success,
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform