Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
$$$ and FOPEN('PRN') -- Sometimes they work ??
Message
From
23/06/1999 18:58:05
 
 
To
23/06/1999 01:50:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00231857
Message ID:
00233266
Views:
34
>Hi Ed.
>
>I've implemented a wrapper for the COPYFILE command. (See attached.)
>
>Unfortunately I have not succeeded in writing to a network printer with it.
>It seems to work reliably with the local printer.
>
>With LPT1: redirected using the CAPTURE command, I don't get any printer output when I copy to LPT1:
>
>? C0PYF_RS('TESTFILE.TXT','LPT1:',0)
>
>COPYFILE returns '3' in this case.

According to WinError.H, this is ERROR_PATH_NOT_FOUND; it indicates that the path isn't valid for the current environment.

>
>If I go to DOS and issue the command DIR >PRN I do get output on the network printer. (A dotmatrix ALPS printer).
>
>If I use OpenF('PRN') I can print the same characters to the network printer.
>
>I've also tried COPYF_RS with a network printer specified without success.
>
>What is the best way to find out the \\Server\Printer share name?
>

You can search for all shared devices using the sample code in my NETRESOURCE class; there's a sample peice of code in the .ZIP file that will search for all shares of all types, and it'd be fairly easy to modify it to restrict the search to printers. ANETRESOURCES() can also search specifically for shared printers.

You can download NETRSC.ZIP and CLSHEAP.ZIP to get the necessary VFP source (NETRESOURCE relies on my heap management class to maintain the NETRESOURCE structure.)

You should also be able to see the network printers within the Add Printer dialog, or from Network Neighborhood.

I tested the example code with a valid UNC under MS Networking (I have a shared printer on my home network) and under Novell 3.20 at my office, but I knew the share names of the printers in both cases. I don't remember testing with a Novell printer attached using the CAPTURE command under Win95; under Win98 there was no problem sending to printers attached to our network's print queues using Intel NetPorts. As I remember, Novell-attached print devices are addressed in the form \\Novell Print Server Name\Novell queue name.

Sending to ports and UNCs, you must set the third parameter to 0 to prevent failing when the network queue or port already exists and is in use. The exact details for CopyFile are in the MSDN docs.

>Seems unlikely that I implemented the DLL call incorrectly (because it works fine with a local printer both dot-matrix and laser.) But perhaps you will spot something if you have time to review my code.
>
>TIA
>
>Peter
>
>
>[see separate message for code]
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