Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Splash Screen for the VFP application
Obtaining names and positions for shortcuts located on the Windows Desktop
Printing text with the Escape function
Displaying dimmed window behind VFP top-level form
Subclassing CommandButton control to create BackColor property
How to put a vertical text scrolling on the form (a movie cast)
Enumerating devices installed on the local machine
How to make a VFP form fading out when released (GDI version)
Converting image file to .ICO file
System Image List Viewer
Vertical Label control
Class library providing access to the System Registry
GDI+: Implementing image scrolling with inertia
Enumerating Processes -- WinNT
Reading and setting system access privileges for the current process
How to play AVI file on the _screen
Passing data records between VFP applications via the Clipboard
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Winsock: retrieving Web pages using sockets (HTTP, port 80)
CryptoAPI: Collection of Providers class
Mapping and disconnecting network drives
How to detect if additional monitor is connected and active
Displaying icons in the system tray (VFP9)
Custom HttpRequest class (WinHTTP)

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
click to open
Before you begin:
Use this class to send HTTP POST, HTTP GET and other HTTP requests. Use the following code to test it:

#DEFINE ccUrl ""

oHttp = CreateObject("WinHttpRequest")
WITH oHttp
        IF Not .Open("GET", ccUrl)
                ? "Error:", .ErrorCode, .ErrorMsg
                IF Not .Send()
                        ? "Error:", .ErrorCode, .ErrorMsg
                        ? .Status
                        ? .StatusText
                        ? .GetAllResponseHeaders()
                        ? .GetResponseHeader("connection:")
                        ? "Response length:", .ResponseLen
                        SET SAFETY OFF
                        StrToFile(.ResponseText, "tmp.txt")
                        SET SAFETY ON
                        MODI FILE tmp.txt NOWAIT

There is a similar class built on WinINet functions: Custom HttpRequest class (WinINet).
  Members area. Log in to view this example.
  User name:
  Forgot your password?
  Sign up for
the Membership

User rating: 8/10 (1 votes)
Rate this code sample:
  • ~
12922 bytes  
Created: 2003-04-07 19:20:07  
Modified: 2016-02-25 09:23:01  
Visits in 7 days: 222  
Listed functions:
Printer friendly API declarations
My comment:
Nov. 26, 2003: code completely rewritten.

Take a look at About WinHTTP page on MSDN.

* * *
Dec.26, 2006: For C++ part, install WinHttp 5.1 SDK. The most straightforward way of doing that is downloading 400Mb of Windowsฎ Server 2003 R2 Platform SDK.

#kwd: sln_http.
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:
Jacek Cenzartowicz | 2006-10-05 15:31:31
Hello. There is some problem with CrackUrl function from WinHttpRequest class. After HttpCrackUrl, .host property contain in unicode, some extra trash data at end of the string. The .host property is not null terminated.
When class is used from Command Window (DO example397.prg) it's running fine.
But if you call example397.prg form Click method of CommandButton, you will get corrupted .host very often.
I wrote my own CrackUrl, and now this class is working fine.
A.M. | 2006-10-09 13:08:32
Jacek, thanks!

I have added changes to the function. When parsing the return of WinHttpCrackUrl() the Length members of the URL_COMPONENTS structure are used instead of double CHR(0).

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.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
3 sec.Function: 'CreateJobObject'
Function group: 'Process and Thread'
7 sec.Function: 'ConnectNamedPipe'
Function group: 'Pipe'
11 sec.Example: 'Custom GDI+ class'
15 sec.Login
19 sec.Function: 'GetEnvironmentVariable'
Function group: 'Process and Thread'
22 sec.
Function group: 'Time'
25 sec.Example: 'Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)'
30 sec.Function: 'GetCurrentThreadId'
Function group: 'Process and Thread'
34 sec.Function: 'CreateDirectory'
Function group: 'File Management'
37 sec.Function: 'GetMonitorBrightness'
Function group: 'Monitor Configuration (Vista)'
Advertise here!