Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any way to speed this up?
Message
 
 
À
17/05/2006 08:53:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01122411
Message ID:
01122743
Vues:
21
Ok, I've switched to RawPrint for printing text files instead of filetostr or TYPE. Here is my latest code:
local lcError, loErr, lcFileExt, llPrinted, oPrnDev
llPrinted = .f.
if not empty(thisform.cReportFile)
	lcFileExt = lower(justext(thisform.cReportFile))
	try
		do case
		case inlist(m.lcFileExt,'txt','prn','dat')
			oPrnDev = newobject("PrintDev","RawPrint.vcx")
			oPrnDev.cDocName = "Printing " + justfname(thisform.cReportFile)
			oPrnDev.cPrinterName = set('printer', 3) && Default Printer

			if oPrnDev.oOPen()
				oPrnDev.cFilename = thisform.cReportFile
				oPrnDev.oPrintFile()
				oPrnDev.oClose()
				llPrinted = .t.
			else
* Error opening device; display error number
				=ErrorMsg("OpenPrinter() Error: " + str(oPrnDev.nOpenError))
			endif
		case m.lcFileExt = 'pdf'
			=PrintPDF(thisform.cReportFile)
		otherwise
			=ErrorMsg("Printing of " + m.lcFileExt + " is not currently supported.")
		endcase
	catch to loErr
		lcError = Log_Error(m.loErr)
		=ErrorMsg(m.lcError)
		llPrinted = .f.
	endtry
	if m.llPrinted
		wait window "Re-Printing completed!" timeout 2
		thisform.release()
	endif
endif
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform