Επεξεργασία

Κοινή χρήση μέσω


NetAddr_GetAddress macro (shellapi.h)

Indicates whether a network address conforms to a specified type and format.

Syntax

void NetAddr_GetAddress(
             hwnd,
  [in, out]  pv
);

Parameters

hwnd

A handle to the network address control that contains the address to validate.

[in, out] pv

A pointer to an NC_ADDRESS structure to receive network address information in parsed form, if the address format and type in the control specified by hwnd are validated. The calling application is responsible for allocating the memory for this structure.

Return value

None

Remarks

Use the NetAddr_GetAddress macro to validate a network address in a network address control against a preset network address type mask. To instantiate, use the class msctls_netaddress defined in Shellapi.h. Call InitNetworkAddressControl at run time before calling this macro. This initializes the common controls library that contains the network address control.

This macro gets the network address string from a network address control, parses the string, and checks whether the string matches a network address type mask. If the string matches the mask, the function returns S_OK and returns the string in parsed form to the calling application (including the port number, prefix length, and other address information), using the NC_ADDRESS structure pointed to by pv. This macro returns E_INVALIDARG if the calling application fails to allocate the structure pointed to by pv.

Representations of Internet Protocol (IP) address versions 4 and 6 (v4/v6) for services and networks, as well as named Internet addresses and services using Domain Name System (DNS) format are parsed. If the network address string represents a named host name (DNS) or service, the value returned in the PrefixLength member of NC_ADDRESS is zero.

Set the network address type mask using the NetAddr_SetAllowType macro before you call the NetAddr_GetAddress macro.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shellapi.h

See also

NetAddr_GetAllowType