johnny-walker Moderador


Registrado: Sábado, 4 de Outubro de 2003 Mensagens: 10653 Localização: Contagem/MG - BRAZIL
|
Enviada: Dom Mai 25, 2008 10:26 pm Assunto: |
|
|
Amigo para renovar o IP, se ele for dinamico vc pode usar este comando:
IPConfig /flushdns
IPConfig /Release
IPConfig /Renew
Isto força a mudança de ip e tb libera o cachedns, infelizmente não funciona com modens adls roteadores, pois a conexão fisica é feita por eles...
é simples passar estes comandos o delphi... por isto não entrarei em detalhes...
quanto ao proxy, de uma olhada nestas funções e pesquise mais a respeito, saiba que o proxy é local ao browser utilizado:
| Código: |
function GetProxyInformation: string;
var
ProxyInfo: PInternetProxyInfo;
Len: LongWord;
begin
Result := '';
Len := 4096;
GetMem(ProxyInfo, Len);
try
if InternetQueryOption(nil, INTERNET_OPTION_PROXY, ProxyInfo, Len) then
if ProxyInfo^.dwAccessType = INTERNET_OPEN_TYPE_PROXY then
begin
Result := ProxyInfo^.lpszProxy
end;
finally
FreeMem(ProxyInfo);
end;
end;
{**************************************************************************
* NAME: GetProxyServer
* DESC: Proxy-Server Einstellungen abfragen
* PARAMS: protocol => z.B. 'http' oder 'ftp'
* RESULT: [-]
* CREATED: 08-04-2004/shmia
*************************************************************************}
procedure GetProxyServer(protocol: string; var ProxyServer: string;
var ProxyPort: Integer);
var
i: Integer;
proxyinfo, ps: string;
begin
ProxyServer := '';
ProxyPort := 0;
proxyinfo := GetProxyInformation;
if proxyinfo = '' then
Exit;
protocol := protocol + '=';
i := Pos(protocol, proxyinfo);
if i > 0 then
begin
Delete(proxyinfo, 1, i + Length(protocol));
i := Pos(';', ProxyServer);
if i > 0 then
proxyinfo := Copy(proxyinfo, 1, i - 1);
end;
i := Pos(':', proxyinfo);
if i > 0 then
begin
ProxyPort := StrToIntDef(Copy(proxyinfo, i + 1, Length(proxyinfo) - i), 0);
ProxyServer := Copy(proxyinfo, 1, i - 1)
end
end;
procedure TFBrowser.Button1Click(Sender: TObject);
var
ProxyServer: string;
ProxyPort: Integer;
begin
GetProxyServer('http', ProxyServer, ProxyPort);
Label1.Caption := ProxyServer;
label2.Caption := IntToStr(ProxyPort);
end;
este aqui funciona para internet explorer, não experimentei ok.
var
MyInternetProxyInfo: PInternetProxyInfo;
lbResult: boolean;
begin
MyInternetProxyInfo := New(PInternetProxyInfo);
try
MyInternetProxyInfo^.dwAccessType := INTERNET_OPEN_TYPE_PROXY;
MyInternetProxyInfo^.lpszProxy := PChar('127.0.0.1:8080');
MyInternetProxyInfo^.lpszProxyBypass := PChar('<local>');
lbResult := InternetSetOption(nil, INTERNET_OPTION_PROXY,
MyInternetProxyInfo, SizeOf(MyInternetProxyInfo^));
if not lbResult then
raise Exception.Create('Couldn''t apply proxy settings!');
finally
Dispose(MyInternetProxyInfo);
end;
var
MyInternetProxyInfo: PInternetProxyInfo;
lbResult: boolean;
begin
MyInternetProxyInfo := New(PInternetProxyInfo);
try
MyInternetProxyInfo^.dwAccessType := INTERNET_OPEN_TYPE_PROXY;
MyInternetProxyInfo^.lpszProxy := PChar('127.0.0.1:80');
MyInternetProxyInfo^.lpszProxyBypass := PChar('<local>');
lbResult := InternetSetOption(nil, INTERNET_OPTION_PROXY, MyInternetProxyInfo, SizeOf(MyInternetProxyInfo^));
if not lbResult then
raise Exception.Create('Couldn''t apply proxy settings!')
else
Webbrowser.Navigate('http://domain.com');
finally
Dispose(MyInternetProxyInfo);
end;
|
bye _________________ P.O.W.E.R B.Y D.E.L.P.H.I |
|