用FTP控件时,不想设ProxySettings,想直接用“Internet选项”中的代理服务器设置

解决方案 »

  1.   

    ie的设置都在注册表里呢
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
    把健值读出来就可以了,
    至于怎么读注册表,那就是另外一个问题了。
      

  2.   

    flyforlove(为情飞)
    问题是那里没这个设置
      

  3.   

    如果你设置了代理服务器,这里面一定有proxyserver和proxyenable这两个键值。
    第一个是代理服务器地址,第二个是代理服务期是否有效。
      

  4.   

    我有程序但我现在出差在外
    如果需要给我发
    [email protected]
      

  5.   

    function ReadProxy(var proxyStr: string): Boolean;
    const
      ProxyKey = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings';
    type
      pboolean = ^boolean;
    var
      Value: array[0..2047] of Char;
      Len, KeyType: integer;
      theHKey: HKEY;
    begin
      Len := sizeof(Value);
      result := false;
      proxyStr := '';  if RegOpenKeyEx(HKEY_CURRENT_USER, ProxyKey, 0, KEY_READ, theHKey) = ERROR_SUCCESS then
      begin
        KeyType := REG_SZ;
        if RegQueryValueEx(theHKey, 'ProxyIP', nil, @KeyType, Windows.PByte(@Value), @Len) = ERROR_SUCCESS then
          proxyStr := StrPas(Value);    KeyType := REG_DWORD;
        if RegQueryValueEx(theHKey, 'UseProxy', nil, @KeyType, Windows.PByte(@Value), @Len) = ERROR_SUCCESS then
          Result := Boolean(PDWORD(@Value)^);
        RegCloseKey(theHKey);
      end;
    end;
      

  6.   

    type
    PWinHttpCurrentUserIeProxyConfig = ^TWinHttpCurrentUserIeProxyConfig;
     TWinHttpCurrentUserIeProxyConfig = record
       fAutoDetect : boolean;
      lpszAutoConfigUrl : PWideChar;
      lpszProxy : PWideChar;
      lpszProxyBypass : PWideChar;
    end;  TWinHttpGetIeProxyConfigForCurrentUser = function (pProxyConfig :
    PWinHttpCurrentUserIeProxyConfig) : boolean; stdcall;var
      WinHttpGetIeProxyConfigForCurrentUser :
    TWinHttpGetIeProxyConfigForCurrentUser;...
    H : = LoadLibrary ('winhttp.dll');
    if H <> 0 then
    try
      @WinHttpGetIeProxyConfigForCurrentUser  := GetProcAddress (H,
    'WinHttpGetIEProxyConfigForCurrentUser');
      if Assigned (WinHttpGetIeProxyConfigForCurrentUser) then
        ...
    finally
      FreeLibrary (H);
    end;Hope that helps,
      

  7.   

    在WIN2000上通过
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      PWinHttpCurrentUserIeProxyConfig = ^TWinHttpCurrentUserIeProxyConfig;
      TWinHttpCurrentUserIeProxyConfig = record
         fAutoDetect : boolean;
         lpszAutoConfigUrl : PWideChar;
         lpszProxy : PWideChar;
         lpszProxyBypass : PWideChar;
    end;
      TWinHttpGetIeProxyConfigForCurrentUser = function (pProxyConfig :PWinHttpCurrentUserIeProxyConfig) : boolean; stdcall;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      WinHttpGetIeProxyConfigForCurrentUser :TWinHttpGetIeProxyConfigForCurrentUser;
      WinHttpCurrentUserIeProxyConfig:PWinHttpCurrentUserIeProxyConfig;
    implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    var H:Thandle;
    begin
       New(WinHttpCurrentUserIeProxyConfig);
       H := LoadLibrary ('winhttp.dll');
       if H <> 0 then
          try
            @WinHttpGetIeProxyConfigForCurrentUser  := GetProcAddress (H,'WinHttpGetIEProxyConfigForCurrentUser');
          if Assigned (WinHttpGetIeProxyConfigForCurrentUser) then
             WinHttpGetIeProxyConfigForCurrentUser(WinHttpCurrentUserIeProxyConfig);
          finally
             FreeLibrary (H);
          ShowMessage(WinHttpCurrentUserIeProxyConfig^.lpszProxy);
    end;
    end;end.