Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

ANetResources()

ANetResources() returns an array of the file or printer shares available.

Usage

nCount = ANetResources( ArrayName, cServer, nFileOrPrint )

Parameter

Value

Meaning

ArrayName

Array name

The array to be filled with the requested information. The usual VFP array behavior occurs: If no resources are found, the array isn't created if it doesn't exist, and isn't redimensioned if it already exists. If the resources do exist, the array is created if necessary, and is redimensioned to a one-column array with the proper number of rows if it does exist.

cServer

Character

The name of the network or domain resource to query.

nFileOrPrint

0

Return all resources.

1

Return file resources.

2

Return print resources.

nCount

Numeric

The number of resources found. 0 if no resources are shared or the server can't be contacted.

A share is a directory or printing device on another computer on the network that has been made available for use by the network users. They are named using the Universal Naming Convention (UNC) as a string of the form “\ServerName\ResourceName” and can be accessed through the Explorer, the DOS command line (NET USE for Windows, MAP for Netware) or within FoxPro by functions that support the UNC means of access—we’re pleased to note that more and more functions and commands in VFP 6.0 and later seem to support this. VFP 7 lets you specify a domain name or workgroup instead of specifying a server, and adds the ability to get all resources with a single call. Use ANetResources() to get a list of these file or printer shares. You might want to use this list to display options to the operator as to where files might be found or saved, or to choose which print device to use. You do need to know the name of the server or domain providing the service in advance—this isn’t a tool to broadcast a request for services available. Look at the second column of the array created by APRINTERS() to get some server names.

Example

* Get the names of printer shares from Prometheus.
? ANETRESOURCES(laNet, "\\Prometheus", 2)

See Also

APrinters(), Directory(), File(), PrtInfo()