Compartir a través de


ANETRESOURCES( ) Function

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

ANETRESOURCES(ArrayName, cNetworkName, nResourceType)

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.

Return Value

Numeric

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.

Note

Before Windows 2000, share names were limited to twelve characters in length. If you run ANETRESOURCES() on a computer that uses an operating system earlier than Windows 2000, ANETRESOURCES() will not return any shares that are on computers running Windows 2000 or later that have share names longer than twelve characters.

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

See Also

Reference

ADIR( ) Function

APRINTERS( ) Function

GETPRINTER( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)