WinHttpRequest.SetProxy (msdn)
HTTPREQUEST_PROXYSETTING_DEFAULT
Default proxy setting. Equivalent to HTTPREQUEST_PROXYSETTING_PRECONFIG.
HTTPREQUEST_PROXYSETTING_PRECONFIG
Indicates that the proxy settings should be obtained from the registry. This assumes that Proxycfg.exe has been run. If Proxycfg.exe has not been run and HTTPREQUEST_PROXYSETTING_PRECONFIG is specified, then the behavior is equivalent to HTTPREQUEST_PROXYSETTING_DIRECT.
HTTPREQUEST_PROXYSETTING_DIRECT
Indicates that all HTTP and HTTPS servers should be accessed directly. Use this command if there is no proxy server.
HTTPREQUEST_PROXYSETTING_PROXY
When HTTPREQUEST_PROXYSETTING_PROXY is specified, varProxyServer should be set to a proxy server string and varBypassList should be set to a domain bypass list string. This proxy configuration applies only to the current instance of the WinHttpRequest object.
varProxyServer
[in, optional] A value of type VARIANT that is set to a proxy server string when ProxySetting equals HTTPREQUEST_PROXYSETTING_PROXY.
varBypassList
[in, optional] A value of type VARIANT that is set to a domain bypass list string when ProxySetting equals HTTPREQUEST_PROXYSETTING_PROXY.
Option Explicit
'WinHttpRequest proxy settings.
Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0
Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0
Const HTTPREQUEST_PROXYSETTING_DIRECT = 1
Const HTTPREQUEST_PROXYSETTING_PROXY = 2
Private Sub Command1_Click()
Dim HttpReq As Object
' Create the WinHTTPRequest ActiveX Object.
Set HttpReq = New WinHttpRequest
' Switch the mouse pointer to an hourglass while busy.
MousePointer = vbHourglass
'Set proxy settings.
HttpReq.SetProxy HTTPREQUEST_PROXYSETTING_PROXY, _
"proxy_server:80", "*.microsoft.com"
' Open an HTTP connection.
HttpReq.Open "GET", "http://microsoft.com", False
' Send the HTTP Request.
HttpReq.Send
' Get all response text.
Text1.Text = HttpReq.ResponseText
' Switch the mouse pointer back to default.
MousePointer = vbDefault
End Sub