Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CopyFile not working with captured port
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00510833
Message ID:
00512184
Views:
12
>In general you have to think of many processes being attached to the printer, queue or printer-port. Think of your PC's OS, the network-OS and VFP. There are too many combinations to explain, and a general printer-attaching routine should contain them all (think of the adding of NT2K and 15 combinations are added).
>To understand this, try -on the concerning PC !- to fuzz around with Capture and look at Net Use's result, and the other way around, Net Use and Capture's result (Capture Show). Depending on the PC's OS mixing is not allowed, and what it comes to is that you should try to be native. IMO you concrete problem here is that the printer-port (or whatever partitiating part) is in use.
>Think also of explicitly Deleting the attached printer before attaching again (e.g. Net Use /Delete).
>
>I must say, I think a Copy File was never used by us, and may cause additional problems. Think of two processes may need the printer (port etc.) at the same time. Try to be as native as possible, which in this case would be !Copy YourFile >PRN; this eliminates the VFP thread.

Won't work for at least three reasons; first, COPY is an internal DOS command, so you'd be required to start another instance of the CLI explicitly, second, the target of COPY is not the STDOUT, so redirection via ">" is ineffective, and third, COPY will strip certain ASCII characters and terminate prematurely on receipt of some such as CHR(26) unless you tell it to operate in binary mode. If you wanted to shell out and use COPY, you need a different command line, ie:
RUN COMMAND /C COPY /B YOURFILE PRN:
Since COPY is going to invoke CopyFile() IAC, you needlessly complicate the process, make error detection difficult, and pop a DOS box in the process.

OBTW, WinNT and Win2K do not define the DOS Device PRN: by default; you have to do it yourself.
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