用FTP控件时,不想设ProxySettings,想直接用“Internet选项”中的代理服务器设置
解决方案 »
- 如何使用scrollbar控制ScrollBox的水平滚动条?
- 请问在编译时报 internal error: L3169 这个错,是什么原因,如何解决?
- ★★★★★★★欢迎试用《文件夹守护神》★★★★★★★★
- 如何用installshield在桌面建立一个快捷菜单,是一个指向某网址(不是html文件)的快捷方式
- 公安ccic库是oracle吗?我不会添加进数据库,扩展名是.dat
- 怎样用DBImage显示出数据库中*.jpg格式的图片
- 关于前途的问题。请大家多谈谈。来者有分。(我不混了。散分~!2330分)
- 关于delphi6中的Demos\Corba\Idl2Pas\Midas XML例子
- delphi中 如何实现类似delphi帮助主题查询
- 关于Interbase日期查询问题,高手请进
- 新手问题 谢谢!
- lookup字段的用法
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
把健值读出来就可以了,
至于怎么读注册表,那就是另外一个问题了。
问题是那里没这个设置
第一个是代理服务器地址,第二个是代理服务期是否有效。
如果需要给我发
[email protected]
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;
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,
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.