Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
GDI+: printing vertical text on VFP reports via generated images (VFP8)
How to create transparent areas inside a form -- punching holes in the form
Moving shortcut to a specified position on the Windows Desktop
Reading security permissions for NTFS files and folders
System Image List Viewer
Using Path functions from Shell Lightweight Utility APIs (shlapi.dll)
Converting an HTTP time/date string to a SYSTEMTIME structure
Drawing Windows frame controls using the DrawFrameControl function
How to copy the image of a form to the Clipboard using Bitmap API functions
How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory
Placing an arbitrary rectangular area of main VFP window on the Clipboard
Quering waveform-audio output devices
Enumerating ODBC drivers available on the local computer
GDI+: printing vertical text on VFP reports via generated images (VFP9)
Using the SetErrorMode for determining if a floppy drive is ready
GDI+: Creating thumbnails to preview images in a directory
Printing text on the client area of the main VFP window
Retrieving list of all active RAS connections
Shortcut Menu Class
Using FillMemory
Using GetFileSize
Customizing the frame of top-level form: removing the standard frame (VFP9, Vista)
Using InternetGoOnline function
Another way to go online (it is not about choosing an ISP)
Retrieving the User Datagram Protocol (UDP) listener table

User rating: 8/10 (1 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
User Datagram Protocol. A communications protocol for the Internet network layer, transport layer, and session layer, which makes it possible to send a datagram message from one computer to an application running in another computer.

Like TCP (Transmission Control Protocol), UDP is used with IP (the Internet Protocol).

Unlike TCP, UDP is connectionless and does not guarantee reliable communication; the application itself must process any errors and check for reliable delivery.

The UDP listener table contains information about this computer`s UDP end-points on which a local application is currently accepting datagrams.



See also:
Retrieving the interface–to–IP address mapping table
 
DO declare
 
*| typedef struct _MIB_UDPTABLE {
*|   DWORD       dwNumEntries;    // number of entries in the table
*|   MIB_UDPROW  table[ANY_SIZE]; // table of MIB_UDPROW structs
*| } MIB_UDPTABLE, *PMIB_UDPTABLE; total bytes = 4 + undef
 
*| typedef struct _MIB_UDPROW {
*|   DWORD   dwLocalAddr;    // IP address on local computer
*|   DWORD   dwLocalPort;    // port number on local computer
*| } MIB_UDPROW, *PMIB_UDPROW; total bytes = 8
 
#DEFINE MIB_UDPROW_SIZE  8
 
LOCAL cBuffer, nBufsize, nEntries, nIndex, cEntry
 
* call GetUdpTable with null buffer to get required size
nBufsize=0
= GetUdpTable(NULL, @nBufsize, 1)
 
cBuffer = Repli(Chr(0), nBufsize)
= GetUdpTable(@cBuffer, @nBufsize, 1)
 
* get number of entries in the table
nEntries = buf2dword(SUBSTR(cBuffer, 1,4))
 
* create resulting cursor
CREATE CURSOR cs (ipaddr C(15), port N(12))
 
* parse entries and save results in cursor
FOR nIndex = 1 TO nEntries
 
    cEntry = SUBSTR(cBuffer,;
        5 + (nIndex-1) * MIB_UDPROW_SIZE,;
        MIB_UDPROW_SIZE)
 
    = AddEntry(cEntry)
ENDFOR
 
GO TOP
BROW NORMAL NOWAIT
* end of main
 
PROCEDURE AddEntry(cEntry)
    LOCAL lcIPAddr, lnPort
 
    * local IP address and the host name
    lcIPAddr = inet_ntoa(buf2dword(SUBSTR(cEntry, 1,4)))
 
    * local port
    lnPort = ntohs(buf2dword(SUBSTR(cEntry, 5,4)))
 
    INSERT INTO cs VALUES (lcIPAddr, lnPort)
RETURN
 
FUNCTION buf2dword(cBuffer)
RETURN Asc(SUBSTR(cBuffer, 1,1)) + ;
    Asc(SUBSTR(cBuffer, 2,1)) * 256 +;
    Asc(SUBSTR(cBuffer, 3,1)) * 65536 +;
    Asc(SUBSTR(cBuffer, 4,1)) * 16777216
 
PROCEDURE declare
    DECLARE STRING inet_ntoa IN ws2_32 INTEGER in_addr
    DECLARE INTEGER ntohs IN ws2_32 INTEGER netshort
 
    DECLARE INTEGER GetUdpTable IN iphlpapi;
        STRING @pUdpTable, INTEGER @pdwSize, INTEGER bOrder
 
 
 

User rating: 8/10 (1 votes)
Rate this code sample:
  • ~
1800 bytes  
Created: 2001-12-23 10:04:53  
Modified: 2005-09-17 09:28:45  
Visits in 7 days: 114  
Listed functions:
GetUdpTable
inet_ntoa
ntohs
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:
There are no notes on this subject.


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 (54.224.79.93)
4 sec.Example: 'Using File Mapping for enumerating files opened by Visual FoxPro'
1.27 hrs.Function: 'NetUserEnum'
 Function: 'RegEnumValue'
Function group: 'Registry'
2.24 hrs.Function: 'CM_Get_Sibling_Ex'
 Function: 'HeapReAlloc'
3.96 hrs.
Function group: 'ODBC API'
 Function: 'WindowFromDC'
4.31 hrs.Function: 'WSAGetLastError'
Function group: 'Windows Sockets 2 (Winsock)'
 Example: 'Get the power status of your laptop computer'
4.78 hrs.Function: 'GetGUIThreadInfo'
Google
Advertise here!