用Delphi检测IE使用的代理服务器

出处:CSDN 2004年11月11日 作者:laoli 责任编辑:linjixiong

文章导读:如果我们开发的对象,不是在公网的环境内上网,是使用内网的,我们应该怎么样检测你的IE使用的代理服务器呢?接下来我们通过以下实例来学习:

  如果我们开发的对象,不是在公网的环境内上网,是使用内网的,我们应该怎么样检测你的IE使用的代理服务器呢?接下来我们通过以下实例来学习:
  


  //-----------------------------------------------
  //记得引用 WinInet 单元
  //-----------------------------------------------
  uses
  WinInet

  //----------------------------------------------
  //定义要使用的函数
  //----------------------------------------------

  function GetProxyInformation: string;
  var
  ProxyInfo: PInternetProxyInfo;
  Len: LongWord;
  begin
  Result := '';
  Len := 4096;
  GetMem(ProxyInfo, Len);
  try
  if InternetQueryOption(nil, INTERNET_OPTION_PROXY, ProxyInfo, Len) then
  if ProxyInfo^.dwAccessType = INTERNET_OPEN_TYPE_PROXY then
  begin
  Result := ProxyInfo^.lpszProxy
  end;
  finally
  FreeMem(ProxyInfo);
  end;
  end;

  procedure GetProxyServer(protocol: string; var ProxyServer: string;
  var ProxyPort: Integer);
  var
  i: Integer;
  proxyinfo, ps: string;
  begin
  ProxyServer := '';
  ProxyPort := 0;

  proxyinfo := GetProxyInformation;
  if proxyinfo = '' then
  Exit;

  protocol := protocol + '=';

相关快问问题
频道精选

爱很简单!教您DIY制造浪漫

爱很简单!教您DIY制造浪漫

不花钱又能表达芳心,为对方设计情人节贺卡或者壁纸之类的,相信你的花心思制作的作品也能感动对方。...[详细]

本周十大热评文章
本周十大人气文章
壁纸图赏