Group: IP Helper - Library: iphlpapi
DWORD GetBestInterface(
IPAddr dwDestAddr,
PDWORD pdwBestIfIndex
); DECLARE LONG GetBestInterface IN Iphlpapi;
LONG dwDestAddr,;
LONG @pdwBestIfIndex dwDestAddr [in] The destination IPv4 address for which to retrieve the interface that has the best route, in the form of an IPAddr structure.
pdwBestIfIndex [out] A pointer to a DWORD variable that receives the index of the interface that has the best route to the IPv4 address specified by dwDestAddr.
If the function succeeds, the return value is NO_ERROR (0).
LOCAL nDstIP, nIIndex
nDstIP = inet_addr("66.94.234.13")
nIIndex=0
IF GetBestInterface(nDstIP, @nIIndex) = 0
? "Index of the interface", nIIndex
ENDIFSee also: GetBestRoute, GetNumberOfInterfaces, GetIfEntry.
Home