I want to set proxy in action connection for IE with Delphi codes. I test this code:
Procedure SetProxy(const Server: String);
var
Reg : TRegistry;
begin
Reg := TRegistry.Create;
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Internet Settings',False);
Reg.WriteString('ProxyServer',Server);
Reg.WriteBool('ProxyEnable',True);
Reg.CloseKey;
Reg.Free;
InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, 0, 0);
end;
But it is change only LAN Setting in IE Internet Option.
Anyone have a solution for that?
Additional: How can I retrieve Connection names list?
Amin, in your code you are setting the global proxy server. The setting for each connection is stored in this location
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
in a binary format which is not very well documented, so you must figure out the format and position to write the correct data.Instead of the windows registry you can use the
InternetSetOption
function, check this sample application which update the proxy configuration for a particular connection.