ANETRESOURCES( ) Function

See Also

Places the names of network shares or printers into an array and then returns the number of resources.

Syntax

ANETRESOURCES(ArrayName, cNetworkName, nResourceType)

Returns

Numeric

Arguments

ArrayName

Specifies the name of the array containing the network share or printer information. If the array you specify doesn’t exist, Visual FoxPro automatically creates the array. If the array exists and isn’t large enough to contain all the information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro truncates the array.

If the array exists and ANETRESOURCES( ) returns 0 because no network shares or printers are found, the array remains unchanged. If the array doesn’t exist and ANETRESOURCES( ) returns 0, the array isn’t created.

cNetworkName

Specifies the name of the network for which share or printer information is returned. The network name should be in the format “\\NetworkName.” You do not have to be connected to the network you specify, and specifying a network doesn’t connect you to the network.

nResourceType

Specifies the type of network resource for which information is returned. The names of shares on the network are returned if nResourceType evaluates to 1. The names of printers on the network are returned if nResourceType evaluates to 2.

Remarks

ANETRESOURCES( ) returns the number of network shares or printers found (identical to the number of rows in the array). ANETRESOURCES( ) returns zero if there are no shares or printers for the network of the type you specify, or the network you specify doesn’t exist.