Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to print picture stored in enhanced-format metafile (*.emf)
Using an Event Object. Part B: running an application responding to events
FindText -- the hopeless and useless Common Dialog
Using the CreateFile
Enhanced GetFont dialog
How to hide your program from the Close Program dialog (Win9* only)
Reading security permissions for NTFS files and folders
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
String representation for disk or memory capacity
Using Beep and Sleep functions to make the old tin buzz sing (WinNT only?)
Displaying the drive type value
Obtaining a handle to the desktop associated with the calling thread
Retrieving information about the specified icon
Retrieving the priority class for the current process
Retrieving top-child window for the VFP form
Saving HKEY_LOCAL_MACHINE\\Software\\ODBC Registry Entries to an XML file
URL: splitting into its component parts
Converting path to original case
CryptoAPI: Collection of Providers class
Deleting a file stored on the FTP server
How to run FoxPro application under different user name (impersonating user)
MapiSendMail class for Visual FoxPro application
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Retrieving long values associated with the class of the VFP window
How to ping a remote site using IP Helper API calls

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
An article "A New Way to Ping" published on CodeGuru pages by Bill Nolde is a source for this example, which is a direct C++ to VFP translation.

Another example shows how to convert a host name (like "www.myhost.com", "microsoft.com", "aol.com" etc.) to IP address in dotted format (like 192.168.0.1).

See also:
  • How to ping a remote site using ICMP API calls
  • How to retrieve adapter information for the local computer (including MAC address)
  • Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
  • Using NetWkstaTransportEnum to obtain MAC Address of remote server
  •  
    DO declare
     
    LOCAL nDst, nHop, nRTT
    nDst = inet_addr("212.58.244.67")  && bbc news
     
    STORE 0 TO nHop, nRTT
     
    IF GetRTTAndHopCount(nDst, @nHop, 50, @nRTT) <> 0
        ? "Hop count to the destination:", nHop
        ? "Round-trip time, in milliseconds:", nRTT
    ELSE
    * on error, GetLastError may still return zero
        ? "Error"
    ENDIF
    * end of main
     
    PROCEDURE declare
        DECLARE INTEGER GetRTTAndHopCount IN Iphlpapi;
            INTEGER DestIpAddress, LONG @HopCount,;
            INTEGER MaxHops, LONG @RTT
     
        DECLARE INTEGER inet_addr IN ws2_32 STRING cp
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    531 bytes  
    Created: 2003-02-03 22:13:46  
    Modified: 2012-12-25 16:51:04  
    Visits in 7 days: 153  
    Listed functions:
    GetLastError
    GetRTTAndHopCount
    inet_addr
    Printer friendly API declarations
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    RB | 2005-06-06 18:21:08
    I have the same problem. With
    ? inet_addr( "10.44.74.139" )
    I have retruned -1958073334. num2dword for that does not work....
    Thank you for reply.
    A.M. | 2005-06-06 20:52:00
    RB, please try this version:

    FUNCTION num2dword(lnValue)
    #DEFINE m0 256
    #DEFINE m1 65536
    #DEFINE m2 16777216
        IF lnValue < 0
            lnValue = 0x100000000 + lnValue
        ENDIF
        LOCAL b0, b1, b2, b3
        b3 = Int(lnValue/m2)
        b2 = Int((lnValue - b3*m2)/m1)
        b1 = Int((lnValue - b3*m2 - b2*m1)/m0)
        b0 = Mod(lnValue, m0)
    RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3)

    Copyright © 2001-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (184.72.184.104)
    3 hrs.Function: 'WinHttpConnect'
    3.69 hrs.Function: 'WinExec'
     Example: 'Retrieving various system metrics'
    4.9 hrs.Example: 'How to play a waveform sound (a WAV file in particular)'
    Language: 'C#'
    5.47 hrs.Example: 'Retrieving information about the main VFP window'
     Solution: 'Extended MessageBox Library (assembly) for .NET'
     Project
    6.13 hrs.Example: 'Using IsChild() for testing ThisForm.ShowWindow property'
    6.14 hrs.Example: 'How to find which fonts Windows uses for drawing captions, menus and message boxes'
    6.94 hrs.Function: 'DragDetect'
    Google
    Advertise here!