inet_pton
function inet_pton(Family: Integer; pszAddrString: PAnsiChar; pAddrBuf: Pointer): Integer; stdcall; external ws2_32 name 'inet_pton';
Family is AF_INET or AF_INET6; pAddrBuf receives an in_addr or an in6_addr. inet_pton returns 1 on success, 0 for a malformed literal, SOCKET_ERROR on failure - so, unlike inet_addr, it can say which happened.