Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
WAV file player
Dial the Net Automatically
Drawing cursors for the classes defined by the system (preregistered): BUTTON, EDIT, LISTBOX etc.
Finding the path to the VFP executable running
How to build UDP responder
Printing text with the Escape function
Reading and setting system access privileges for the current process
Retrieving list of all active RAS connections
Shortcut Menu Class
Testing MS Internet Explorer version installed
Converting an HTTP time/date string to a SYSTEMTIME structure
Drawing a rectangle using Windows regular edges and borders
Printing text on the main VFP window
Retrieving file information for the VFP executable running
Using GetFileSize
A client for testing non-blocking Winsock server
Creating a clipping region from the path selected into the device context of a form
Enumerating Volumes and Volume Mounting Points (NTFS)
Moving shortcut to a specified position on the Windows Desktop
Obtaining provider name for a specific type of network
Using mailslots to send messages on the network
Winsock: creating a socket that is bound to a specific service provider
A procedure for setting file times
Another way to go online (it is not about choosing an ISP)
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: 158  
    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 (107.22.127.92)
    28.83 min.Example: 'Custom GDI+ class'
    4.03 hrs.Example: 'Storing registration key in the resources of an executable file'
     Example: 'Confining Windows calculator inside the VFP main window'
    6.94 hrs.Function: 'BitBlt'
    17.04 hrs.Example: 'Pocket PC: custom RAPI class for operating with files and folders on mobile device'
     Function: '_lopen'
    1 day(s)Example: 'MapiSendMail class for Visual FoxPro application'
     Example: 'Copying files as a transacted operation (Vista)'
     Example: 'Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera'
    Language: 'C#'
     Example: 'How to delete a service object'
    Google
    Advertise here!