Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Custom GDI+ class
Winsock: sending email messages (SMTP, port 25)
Using EnumPrinters function to enumerate locally installed printers
Semi-transparent Form
Custom HttpRequest class (WinHTTP)
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
How to convert a bitmap file to monochrome format (1 bpp)
Custom HttpRequest class (WinINet)
Compressing and decompressing files with Windows API Runtime Library routines
Custom FTP Class for Visual FoxPro application
Printing Image File, programmatically set print page orientation to landscape
How to create MD-5 and SHA-1 hash values from a string
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
GDI+: Creating thumbnails to preview images in a directory
Adding icon to the systray (requires VFP9)
Extended MessageBox Class
How to ping a remote site using ICMP API calls
GDI+: Storing content of the Clipboard to a bitmap file
Transparent Menu Class (requires VFP9)
Using Month Calendar Control (VFP9, Comctl32.dll)
How to activate Windows Calculator
How to detect if additional monitor is connected and active
How to print FoxPro form
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
 
  Buy this example for $10.00
Instant email delivery.

Read more...
 


User rating: 8/10 (1 votes)
Rate this code sample:
  • ~
12922 bytes  
Created: 2003-04-07 19:20:07  
Modified: 2009-01-03 15:26:33  
Visits in 7 days: 124  
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-2010 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.0.85), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (38.107.191.106)
1.95 min.Function: 'GetPerformanceInfo'
20.78 min.Function: 'GetWindowRgnBox'
Function group: 'Painting and Drawing'
31.75 min.Function: 'waveOutGetPosition'
Function group: 'Windows Multimedia'
2 day(s)
 Function: 'waveInGetDevCaps'
Function group: 'Windows Multimedia'
 Example: 'Obtaining memory performance information for the system'
 
Function group: 'File System'
 
Function group: 'Error Handling'
 Function: 'mixerClose'
Function group: 'Windows Multimedia'
 Function: 'waveInGetErrorText'
Function group: 'Windows Multimedia'
Google
Advertise here!