Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CopyFile() revisited - guru's here please...!
Message
From
23/10/2000 19:11:15
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00433016
Message ID:
00433238
Views:
18
>>thanx Ed
>>
>>example please....
>>
>>also have tried "LPT1:" with the same error code.
>
>
>My printer is attached to the physical port EPUSB1: (a device attached to a local USB port) on my workstation, and I share a laser jet from the machine that acts as my PDC:
>
>DECLARE INTEGER CopyFile IN WIN32API STRING @, STRING @, INTEGER
>=CopyFile('MyFileToPrint.TXT','EPUSB1:',0)
>=CopyFile('MyOtherFileToPrintOnNet.TXT','\\esolutio-5flg\HPLJ_Share',0)
>
>works just fine under Win2K and Win98 and ME, all that I have to play with. You need to know the -physical- device name for the local device, the local device name a network printer is mapped to locally using NET USE or an API call, or the UNC of shared printer that isn't mapped that you have rights to based on your current userid and password.
>
>In the case of a UNC, if you can't be authenticated through a domain authentication resource, your Windows userid and password are used to request authentication in the scope of the local machine sharing the resource.

BTW, the return on success is non-zero, and GetLastError() is called in the event that 0 is returned from the call. Your printer may not print until it receives an end-of-page indicator to tell it that you've finished the page (typical of many lasers).

This behavior is confirmed right now on a Win2K Pro running SP1, the Epson 740 on EPUSB1:, and now to two different net printers, one on an ME box, and the other on my PDC. It is not a problem with the API declaration or implementation under Win2K.

If I try to print to a non-existant device, I eventually time out and return 0. If I try to print a non-existant file to an existing port, it returns a 0, and tells me file not found. CopyFile() does not pay attention to any pathing in your VFP path; you need a real file reference.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform