Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
How to change display settings: screen resolution, screen refresh rate
GDI+: Implementing image scrolling with inertia
Obtaining names and positions for shortcuts located on the Windows Desktop
Vertical Label control
Displaying dimmed window behind VFP top-level form
Enumerating devices installed on the local machine
How to generate GUID values
Printing Image File, programmatically set print page orientation to landscape
Disconnecting USB Mass Storage Device programmatically
Monitoring clipboard content changes (VFP9)
Subclassing CommandButton control to create BackColor property
Storing content of the Clipboard to a bitmap file
Adding a background image to VFP report (VFP9, ReportListener)
Browsing Windows Known Folders (Special Folders)
Splash Screen for the VFP application
How to put a vertical text scrolling on the form (a movie cast)
Compressing and decompressing files with Windows API Runtime Library routines
How to load a user profile
How to control Adobe Reader 9.0 (SDI mode) from VFP application
Generating random cryptographic keys
How to disable the Windows Clipboard (VFP9)
Detecting changes in connections to removable drives (VFP9)
GDI+ fun: roach-infested desktop
Winsock: changing the byte ordering

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
* you do not need to call the WSAStartup function
* before using these functions

DECLARE INTEGER ntohs IN ws2_32 INTEGER netshort
DECLARE INTEGER ntohl IN ws2_32 INTEGER netlong
DECLARE INTEGER htonl IN ws2_32 INTEGER hostlong
DECLARE INTEGER htons IN ws2_32 INTEGER hostshort

* HOST to NET  u_short -- htons
* NET  to HOST u_short -- ntohs
* HOST to NET  u_long  -- htonl
* NET  to HOST u_long  -- ntohl

? "*** Working with U_SHORT values"
lnFtpPort = htons(21)
? "Converted to the network byte order:",lnFtpPort
? "Host byte order again:", ntohs(lnFtpPort)

? "*** Working with U_LONG values"
lnTelnetPort = htonl(23)
? "Converted to the network byte order:", lnTelnetPort
? "Host byte order again:", ntohl(lnTelnetPort)

DECLARE INTEGER inet_addr IN ws2_32 STRING cp
DECLARE STRING inet_ntoa IN ws2_32 INTEGER in_addr

* The inet_addr function converts a string containing an (Ipv4) 
* Internet Protocol dotted address into a proper address 
* for the IN_ADDR structure
? "*** Converting IP addresses"
lnIP = inet_addr("")
? "String value converted into a proper address:", lnIP

* The inet_ntoa function converts an (Ipv4) Internet network address 
* into a string in Internet standard dotted format
? "Converted back to a string value:", inet_ntoa (lnIP)

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1319 bytes  
Created: 2001-12-19 19:02:10  
Modified: 2001-12-19 19:02:56  
Visits in 7 days: 60  
Listed functions:
Printer friendly API declarations
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
18 sec.Function: 'GdipGetImagePaletteSize'
Function group: 'GDI+ Image'
36 sec.Links
52 sec.Function: 'midiOutClose'
Function group: 'Windows Multimedia'
1.13 min.
Function group: 'Authentication'
1.38 min.
Function group: 'Coordinate Space and Transformation'
1.67 min.Function: 'GetComputerName'
Function group: 'System Information'
1.92 min.
2.5 min.Function: 'CeCopyFile'
Function group: 'Remote Application Programming (RAPI)'
2.83 min.Function: 'JetCloseDatabase'
3.13 min.Function: 'GetWindowRect'
Function group: 'Window'
Advertise here!