If you use IE's default proxy settings:
Hinternet=internetopen (AfxGetAppName (), internet_open_type_proxy,null,null,0);
Change the internet_open_type_proxy into a internet_open_type_preconfig.
If you want to configure your proxy server yourself:
The 3rd parameter of the InternetOpen is set to the IP address of the proxy server:
The format of the proxy must be: [<protocol>=][<scheme>://]<proxy>[:<port>].
Where protocol,scheme://,:p ort are optional, if these three are omitted, they are http,http://,:80 by default.
That is, the HTTP proxy is the default.
The use of various commonly used agents are as follows:
Http:http=http://proxyserver:port
Ftp:ftp:ftp://proxyserver:port
Gopher:gopher=http://proxyserver:port
Socket:socks=proxyserver:port
If the agent has a username/password, you can use the following function settings:
InternetSetOption (Hhandle,internet_option_username, "",);
InternetSetOption (Hhandle,internet_option_password, "",);
To set
Http://faq.csdn.net/read/208215.html
1. Related functions:
Hinternet WINAPI InternetOpen (
LPCTSTR Lpszagent,
DWORD dwAccessType,
LPCTSTR Lpszproxy,
LPCTSTR LpszProxyBypass,
DWORD dwFlags);
BOOL WINAPI InternetSetOption (
Hinternet Hinternet,
DWORD Dwoption,
LPVOID lpbuffer,
DWORD dwbufferlength);
2. Related structures
typedef struct {
DWORD dwAccessType;
LPCTSTR Lpszproxy;
LPCTSTR LpszProxyBypass;
} internet_proxy_info, *lpinternet_proxy_info;
3. Using a proxy server
(1) Please set dwAccessType to Internet_open_type_proxy
(2) Setting Lpszproxy
(a) The format of the agent must be: [<protocol>=][<scheme>://]<proxy>[:<port>].
(b) Where protocol, scheme://,:p ort are optional, if these three are omitted, they default to
HTTP,/.,: 80. That is, the HTTP proxy is the default.
(c) Multiple proxies must be separated with "" (spaces)
(d) The use of various commonly used agents is shown below:
HTTP:
Http=http://proxyserver:port
Ftp:
Ftp:ftp://proxyserver:port
GOPHER
Gopher=http://proxyserver:port
Socks=proxyserver:port
The top three of them can be found on MSDN, but the fourth kind of I have found more than n places to finally find. It is also important to note that MSDN shows that only
InternetOpen How to use a proxy