Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy file .... to lpt1
Message
From
03/03/2004 10:48:03
 
 
To
03/03/2004 10:19:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00821423
Message ID:
00882729
Views:
32
Hi Tracy,

The following code did not print anything: CopyFile(lcfile,SET('printer',3),0) when the default VFP printer was in fact the same as SET('printer',2). I solved by set printer to [desired printer] and then CopyFile(lcfile,'LPT1',0).

In fact, I am not sure that in fact I didn't have some other problem that what I just described to you :)

Thanks for your help,

Alex



>I just implemented this myself. My code below works fine using a network printer:
>
>
>
>IF !printit(hdir+'receipt.txt')
>   =OKAY("An error ocurred printing the receipt. Please reprint the receipt.")
>ENDIF
>
>PROCEDURE printit
>PARAMETERS lcfile
>
>IF TYPE('lcfile')<>"C" .or. EMPTY(lcfile)
>	RETURN .F.
>ENDIF
>
>PRIVATE llreturn
>llreturn = .T.
>
>PRIVATE rcptfile
>rcptfile = lcfile
>PRIVATE rcptprinter
>*--SET('PRINTER',3) is a network printer: \\MYSERVER\hplaserj
>rcptprinter = SET('PRINTER',3)
>
>PRIVATE lcsafety
>lcsafety = SET('SAFETY')
>SET SAFETY OFF
>
>DECLARE INTEGER CopyFile IN KERNEL32.DLL ;
>   STRING @SourceFileName, ;
>   STRING @DestFileName, ;
>   INTEGER bFailIfExists
>IF CopyFile(@rcptfile,@rcptprinter,0) # 0
>   llreturn = .T.
>ELSE
>   llreturn = .F.
>ENDIF
>
>IF TYPE('lcsafety')="C" .and. INLIST(lcsafety,'OFF','ON')
>	SET SAFETY &lcsafety
>ENDIF
>
>CLEAR DLLS 'CopyFile'
>
>RETURN llreturn
>
Previous
Reply
Map
View

Click here to load this message in the networking platform