I use the below program successfully passing a filename and printing to an Okidata ML320 and other dot matrix printers on the network. I was testing this for other reasons in the past. Today I wanted to print to an HP laserjet 4000 on the network and it bombed. It returns a zero and the file does not print. Both are network printers. Both print successfully in VFP using SET PRINTER TO NAME ... fine in all other ways that I print except using copyfile api. Any ideas?
TIA,
Tracy
PARAMETERS lcfile
IF TYPE('lcfile')<>"C" .or. EMPTY(lcfile) .or. !FILE(lcfile)
=OKAY('The report file was not created. An error occured.')
RETURN .F.
ENDIF
PRIVATE llreturn
llreturn = .T.
PRIVATE rcptfile
rcptfile = lcfile
PRIVATE rcptprinter
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
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"