Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CopyFile API Problems with HP LaserJet 4000
Message
From
04/03/2004 15:38:40
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
CopyFile API Problems with HP LaserJet 4000
Miscellaneous
Thread ID:
00883253
Message ID:
00883253
Views:
56
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
*--TCH 03/04/2004
*--Print Using API
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"
Next
Reply
Map
View

Click here to load this message in the networking platform