Hello Sir,
The code will enable and disable the internet connection whilst still allowing network access
The button1 code stores the existing proxy settings, then switches proxy server on and sets the proxy server to a non-existent server.
button2 code restores the proxy settings to the original.
add registry to the uses clause and then 2 buttons with this code
procedure TForm1.Button1Click(Sender
var
lReg: TRegistry;
begin
lReg:=tRegistry.Create;
try
lReg.RootKey := HKEY_CURRENT_USER;
if lReg.OpenKey('\Software\Mi
begin
//get current settings
if lReg.ValueExists('ProxyEna
FEnabled:=lReg.ReadBool('P
if lReg.ValueExists('ProxySer
FProxy:=lReg.ReadString('P
lReg.WriteBool('ProxyEnabl
lReg.WriteString('ProxySer
end;
finally
FreeAndNil(lReg);
end;
end;
procedure TForm1.Button2Click(Sender
var
lReg: TRegistry;
begin
lReg:=tRegistry.Create;
try
lReg.RootKey := HKEY_CURRENT_USER;
if lReg.OpenKey('\Software\Mi
begin
//save original settings
lReg.WriteBool('ProxyEnabl
lReg.WriteString('ProxySer
end;
finally
FreeAndNil(lReg);
end;
end;
with regards,
padmaja.
Main Topics
Browse All Topics





by: HillGrooverPosted on 2005-11-30 at 17:01:06ID: 15393168
does this PAQ help? http://www.experts-exchang e.com/Prog ramming/ Pr ogramming_ Languages/ Delphi/Q_2 1498895.ht ml? query=d isable%2Fe nable+Inte rnet+&topi cs=85