Using Win32 functions in Visual FoxPro Image Gallery
IP Helper
..msdn
GetAdaptersAddresses
GetAdaptersInfo
GetBestInterface
GetBestRoute
GetIfEntry
GetInterfaceInfo
GetIpAddrTable
GetIpNetTable
GetIpStatistics
GetNetworkParams
GetNumberOfInterfaces
GetRTTAndHopCount
GetTcp6Table
GetTcpStatistics
GetTcpTable
GetUdpTable
IcmpCloseHandle
IcmpCreateFile
IcmpSendEcho
if_indextoname
if_nametoindex
IpReleaseAddress
IpRenewAddress
SendARP
Code examples:
GetBestRoute
..msdn    Add comment     W32 Constants      Translate this page
Retrieves the best route to the specified destination IP address.
Code examples:
Declaration:
DWORD GetBestRoute(
    DWORD dwDestAddr,
    DWORD dwSourceAddr,
    PMIB_IPFORWARDROW pBestRoute
);
FoxPro declaration:
DECLARE LONG GetBestRoute IN Iphlpapi;
    LONG dwDestAddr,;
    LONG dwSourceAddr,;
    INTEGER pBestRoute
Parameters:
dwDestAddr
[in] Destination IP address for which to obtain the best route.

dwSourceAddr
[in] Source IP address. This IP address corresponds to an interface on the local computer.

pBestRoute
[out] Pointer to a MIB_IPFORWARDROW structure containing the best route for the IP address specified by dwDestAddr.
Return value:
If the function succeeds, the return value is NO_ERROR (0).
My comment:
#DEFINE MIB_IPFORWARDROW_SIZE 56

nSrcIP = inet_addr("192.168.0.200")
nDstIP = inet_addr("66.94.234.13")

oBuffer = CREATEOBJECT("PChar",;
        REPLICATE(CHR(0), MIB_IPFORWARDROW_SIZE))

IF GetBestRoute(nDstIP, nSrcIP, oBuffer.GetAddr()) <> 0
        ? "GetBestRoute failed with error code:",;
                GetLastError()
        RETURN
ENDIF

cBuffer = oBuffer.GetValue()
nHopIP = buf2dword(SUBSTR(cBuffer, 13, 4))
? inet_ntoa(nSrcIP)

See also: GetBestInterface.
Word Index links for the GetBestRoute :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2007-01-23 17:10:07
Modified: 2007-01-23 17:31:20
Visited in last 7 days: 18
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.80.140.5)
13 sec.Function: 'CeRapiFreeBuffer'
Function group: 'Remote Application Programming (RAPI)'
27 sec.
Function group: 'Dynamic-Link Library'
40 sec.
Function group: 'GDI+ ImageAttributes'
53 sec.Function: 'CeOidGetInfoEx'
Function group: 'Remote Application Programming (RAPI)'
1.13 min.Function: 'CreateWindow'
1.37 min.
Function group: 'GDI+'
1.63 min.Function: 'GetPriorityClass'
Function group: 'Process and Thread'
1.85 min.Function: 'CeEnumDBVolumes'
Function group: 'Remote Application Programming (RAPI)'
2.1 min.Function: 'OpenProcess'
Function group: 'Process and Thread'
2.35 min.
Function group: 'Setup API functions'
Google
Advertise here!