Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing a file directly to a printer
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01351589
Message ID:
01351811
Views:
23
Below is the working class code using the rawprint.vcx.
The filelocn table stores paths to many things including a bar code printer. I create a temporary file and store it in a property of the form.
lcAlias=ALIAS()
IF NOT USED('filelocn')
	USE filelocn IN 0 SHARED
ENDIF
SELE filelocn
LOCATE FOR parm='BCDEPRN'
cSourceFileName=THIS.lblFile
IF FOUND()
	cPrinterName=UPPER(ALLT(DIRECT))
ELSE
	=MESSAGEBOX("Parameter not Configured (BCDEPRN)"+CHR(13)+"Packing List Will Not Print",64,"CANNOT PROCEED")
	RETURN
ENDIF
SET CLASSLIB TO libs\rawprint ADDI
oPrn=CREATEOBJECT("PrintDev")
oPrn.cPrinterName = cPrinterName
oPrn.cfilename = cSourceFileName
IF oPrn.oOpen()
	IF !oPrn.oPrintFile()
		MESSAGEBOX("Error sending to printer")
	ENDIF
	oPrn.oClose()
ELSE
	MESSAGEBOX("OpenPrinter() Error: "+STR(oPrn.nOpenError))
ENDIF

RELEASE oPrn
IF NOT EMPTY(lcAlias)
	SELE (lcAlias)
ENDIF
Boy did it ever work!

But I do have a question, the nOpenError is a number, how do I understand what it means? Is it an error code returned by the printer? the server? the operating system? the whatever? I like to know what error 1400 means. (While testing this appeared.)

Thanks for your help. I have a happy customer.
Mike
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform