呵呵,我搞出来了,代码见下,要use wininet;
procedure TForm1.Button1Click(Sender: TObject);
var
info : INTERNET_PROXY_INFO;
reg : TRegistry;
begin
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
if reg.OpenKey('/Software/Microsoft/Windows/CurrentVersion/Internet Settings',False) then
begin
reg.Writestring('ProxyServer','172.23.23.23:8888');
reg.Writestring('ProxyEnable', '1');
end;
reg.CloseKey;
reg.Free;
info.dwAccessType:=INTERNET_OPEN_TYPE_PROXY;
info.lpszProxy:='172.23.23.23:8888';
InternetSetOption(nil,INTERNET_OPTION_PROXY,@info,1000);
InternetSetOption(nil,INTERNET_OPTION_REFRESH, nil,0);
InternetSetOption(nil,INTERNET_OPTION_SETTINGS_CHANGED, nil,0);
end;