Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Storing content of the Clipboard to a bitmap file
Storing screen shot of a form to bitmap file
How to print FoxPro form
How to print a bitmap file
Vertical Label control
Capturing keyboard activity of another application with the Raw Input API (VFP9)
GDI+: Implementing image scrolling with inertia
Splash Screen for the VFP application
Displaying icons in the system tray (VFP9)
Displaying dimmed window behind VFP top-level form
Pocket PC: custom RAPI class for operating with files and folders on mobile device
Copying picture of the active form to the Clipboard using Enhanced Metafile API functions
Monitoring clipboard content changes (VFP9)
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
Obtaining names and positions for shortcuts located on the Windows Desktop
Extensible Storage Engine class library
Loading a string resource from an executable file
Attaching menu to a top-level form
How to ping a remote site using IP Helper API calls
Enumerating Processes -- WinNT
Custom HttpRequest class (WinINet)
GDI+: sending image of FoxPro form to printer
How to put a horizontal text scrolling on the form (a news line, marquee)
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
Versions:
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:

SET MEMOWIDTH TO 120
#DEFINE ccUrl "http://www.news2news.com/vfp/?example=397"

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

There is a similar class built on WinINet functions: Custom HttpRequest class (WinINet).
 
  Members area. Log in to view this example.
 
  User name:
  Password:
 
 
  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: 169  
Listed functions:
GetLastError
GlobalAlloc
GlobalFree
GlobalSize
WinHttpAddRequestHeaders
WinHttpCloseHandle
WinHttpConnect
WinHttpCrackUrl
WinHttpOpen
WinHttpOpenRequest
WinHttpQueryDataAvailable
WinHttpQueryHeaders
WinHttpReadData
WinHttpReceiveResponse
WinHttpSendRequest
WinHttpSetCredentials
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  
FreeTranslation.com 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-2017 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 (54.145.124.143)
2 sec.Function: 'SQLFreeEnv'
Function group: 'ODBC API'
3 sec.Updates
5 sec.Articles
6 sec.Example: 'How to generate GUID values'
8 sec.Example: 'Winsock: sending email messages (SMTP, port 25)'
10 sec.Function: 'NetMessageNameDel'
Function group: 'Network Management'
11 sec.
13 sec.Function: 'waveInUnprepareHeader'
Function group: 'Windows Multimedia'
15 sec.
18 sec.Example: 'Winsock: how to retrieve a service information corresponding to a service name'
Google
Advertise here!