Using Win32 functions in Visual FoxPro Image Gallery
URL Monikers
..msdn
CreateURLMonikerEx
FindMediaType
IsValidURL
ObtainUserAgentString
URLDownloadToCacheFile
URLDownloadToFile
UrlMkGetSessionOption
Code examples:
How to download a file from HTTP server using URL Monikers functions
The DetectAutoProxyUrl function identifies the auto-config script location
The DetectAutoProxyUrl function identifies the auto-config script location

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
Before you begin:
Citing from the WLUG Wiki:
   Internet Explorer has an [x] Automatically detect settings check box. This will cause the browser to search for the configuration file.

If your DomainName is machine.something.meta.net.nz then InternetExplorer will request the following urls until it finds a WPAD configuration file.

http://wpad.something.meta.net.nz/wpad.dat
http://wpad.meta.net.nz/wpad.dat
http://wpad.net.nz/wpad.dat
http://wpad.nz/wpad.dat


WPAD stands for Web Proxy Auto-Discovery.

 
DO decl
 
LOCAL lcRmScript, lcLocal
lcRmScript = Repli(Chr(0), 250)
 
* dwDetectFlags = 1, 2
* PROXY_AUTO_DETECT_TYPE_DHCP
* PROXY_AUTO_DETECT_TYPE_DNS_A
IF DetectAutoProxyUrl(@lcRmScript, Len(lcRmScript), 2) = 0
    WAIT WINDOW NOWAIT "Not detected. "
    RETURN
ENDIF
 
lcRmScript = STRTRAN(lcRmScript, Chr(0), "")
 
IF Not EMPTY(lcRmScript)
    = MessageB("Location of a WPAD autoproxy script:     " +;
        Chr(13)+Chr(13) + lcRmScript, 64, " DetectAutoProxyUrl")
 
    WAIT WINDOW NOWAIT "Donwloading from URL... "
    lcLocal = SYS(2003) + "\autoscript.txt"
    URLDownloadToFile(0, lcRmScript, lcLocal, 0,0)
    WAIT WINDOW NOWAIT "Downloaded from " + lcRmScript + "   "
 
    IF FILE(lcLocal)
        MODI FILE (lcLocal) NOMODI NOWAIT
    ENDIF
ENDIF
* end of main
 
PROCEDURE decl
    DECLARE INTEGER GetLastError IN kernel32
 
    DECLARE INTEGER DetectAutoProxyUrl IN wininet;
        STRING @lpszAutoProxyUrl, LONG dwAutoProxyUrlLength,;
        LONG dwDetectFlags
 
    DECLARE INTEGER URLDownloadToFile IN urlmon;
        INTEGER pCaller, STRING szURL, STRING szFileName,;
        INTEGER dwReserved, INTEGER lpfnCB
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1094 bytes  
Created: 2002-11-13 14:03:10  
Modified: 2009-01-03 15:26:33  
Visits in 7 days: 19  
Listed functions:
DetectAutoProxyUrl
GetLastError
URLDownloadToFile
Printer friendly API declarations
My comment:
An example of WPAD.DAT file:

function FindProxyForURL(url, host)
{
        // We only cache http and ftp
        if (url.substring(0, 5) == "http:" || url.substring(0, 4) == "ftp:")
                return "PROXY cache:8080; DIRECT";

        // Otherwise use direct connection
        return "DIRECT";
}


#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:
There are no notes on this subject.


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.109)
2.67 min.Example: 'GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)'
33.78 min.Example: 'Reading entries from Event logs'
35.53 min.Function: 'DeleteDC'
53.85 min.Function: 'GetEnvironmentStrings'
Function group: 'Process and Thread'
57.25 min.
2 day(s)Function: 'waveInReset'
Function group: 'Windows Multimedia'
 Function: 'WindowFromDC'
Function group: 'Painting and Drawing'
 
Function group: 'Clipboard'
 Function: 'midiOutShortMsg'
Function group: 'Windows Multimedia'
 Function: 'midiOutReset'
Function group: 'Windows Multimedia'
Google
Advertise here!