Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.34 KB

File metadata and controls

59 lines (41 loc) · 1.34 KB

Home

Function name : GetBestInterface

Group: IP Helper - Library: iphlpapi


Retrieves the index of the interface that has the best route to the specified IPv4 address.


Declaration:

DWORD GetBestInterface(
	IPAddr dwDestAddr,
	PDWORD pdwBestIfIndex
);  

FoxPro declaration:

DECLARE LONG GetBestInterface IN Iphlpapi;
	LONG dwDestAddr,;
	LONG @pdwBestIfIndex  

Parameters:

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.


Return value:

If the function succeeds, the return value is NO_ERROR (0).


Comments:

LOCAL nDstIP, nIIndex  
  
nDstIP = inet_addr("66.94.234.13")  
nIIndex=0  
  
IF GetBestInterface(nDstIP, @nIIndex) = 0  
	? "Index of the interface", nIIndex  
ENDIF

See also: GetBestRoute, GetNumberOfInterfaces, GetIfEntry.