Z
zhangfresh
Unregistered / Unconfirmed
GUEST, unregistred user!
这个问题在论坛解决过多次了,但我调用下面这个函数进行设置代理服务器:procedure SetProxyEx(ProxyProt :string);var inf :INTERNET_PROXY_INFO; len Word;begin if (ProxyProt <> '') then begin inf.dwAccessType := INTERNET_OPEN_TYPE_PROXY; inf.lpszProxy := pchar(ProxyProt); inf.lpszProxyBypass := nil; len := sizeof(inf); InternetSetOption(nil, INTERNET_OPTION_PROXY, @inf, len); InternetSetOption(nil, INTERNET_OPTION_SETTINGS_CHANGED, nil, 0); end else begin inf.dwAccessType := INTERNET_OPEN_TYPE_DIRECT; inf.lpszProxy := nil; inf.lpszProxyBypass := nil; len := sizeof(inf); InternetSetOption(nil, INTERNET_OPTION_PROXY, @inf, len); InternetSetOption(nil, INTERNET_OPTION_SETTINGS_CHANGED, nil, 0); end;end;参数格式为:IPort,设置之后要么不能上网,要么在www.ip.cn中查的ip还是原来的ip。之后加了这个函数写入注册表,也不行procedure TSetProxy.SetReg(FMProxy:string);var reg: Tregistry;begin reg:=Tregistry.Create; try reg.RootKey := HKEY_CURRENT_USER; if reg.OpenKey('/Software/Microsoft/Windows/CurrentVersion/Internet Settings', True) then begin reg.Writestring('ProxyServer', FMproxy); reg.WriteInteger('ProxyEnable', integer(true)); end finally reg.CloseKey; reg.free; end;end;是代码错误还是代理服务器ip有问题?我的代理服务器ip来自:http://www.haozs.net/proxyip/index.php?num=1&coun=China&port=:80