Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Report Problem
Message
From
13/11/2002 09:31:11
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00711664
Message ID:
00722094
Views:
10
>>Nadya,
>>
>>Seems like it occurs (1) on specific pc's kind of always and (2) sometimes on others
>>
>>I'll try all possiblities I've read in this thread when I can
>>
>>As to rebooting the computer, I'm not exactly in favour of that solution. They can print with excel and word on that printer. So somehow, somewhere vfp is likely to be the cause or at least part of it.
>>
>>Thanks for responding,
>>
>>Cheers
>
>There are several threads in the past, where discussed the same problem. Try this one Re: Error Loading Printer Driver 6.0 Bug Thread #654695 Message #655210


Nadya,

Finally solved it. ( I think, no problems reported since a few days now )

Have not tested the 'set printer to default' after having 'set printer to (name)'. Had already implemented the code below. Anyway, the apps use Printer_Set() and Printer_Get() and things can easily be changed if needed in the future.

Should error 1958 reoccur, switch to the code below (wsh code comes from google)
&& to change the printer (in addition to clearing expr, tag & tag2 from the reports) I do this
local sPrint
=Printer_Set(this.Parent.PrinterList.Value, @sPrint)  && this.Parent.PrinterList.Value : combo box with selected printer

&& print

&& to reset the printer
=Printer_Set(sPrint)

&& functions
*-------------------------------------------------------------------------------
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
*-------------------------------------------------------------------------------
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform