ANETRESOURCES( ) Function

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

ANETRESOURCES(ArrayName, cNetworkName, nResourceType)

Return Values

Numeric

Parameters

  • 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 or domain 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. If you specify a domain name, ANETRESOURCES( ) returns an array of members or resources from that domain.

  • 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. A value of 0 returns the name of any resource.

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.

Refer to the WNetOpenEnum and WNetEnumResource Win32 API functions for more details.

See Also

ADIR( ) | Including Resources in Your Applications | APRINTERS( ) | GETPRINTER( )