Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Dec : Re: Am i behind a proxy ?

www.cryer.info
Managed Newsgroup Archive

Re: Am i behind a proxy ?

Subject:Re: Am i behind a proxy ?
Posted by:"dpap" (dp..@softwaypro.gr)
Date:Tue, 19 Dec 2006 01:57:13

wrote the code bellow to test if user must disturb with proxy's stuff or
not.
i haven't a proxy so i can't test it. You think will work ?

function noProxy : boolean;
var s : string;
begin
  result:=true;
        with myHTTP do
  try
        http.Get('http://www.google.com/index.html');
        Disconnect;  // if connection succeeds then don't bother abaout
proxies
  except
   on E: EIdException do begin
            if Request.UseProxy = ctProxy then // else if there is a proxy
ask for parametres
           messageBox(application.Handle,
               pchar(   'connection via a proxy Server .... bla..bla'),'',
                          MB_OK or MB_ICONEXCLAMATION or MB_TOPMOST)
            else messageBox(application.Handle,
               pchar('error ' +E.message),'',
                        MB_OK or MB_ICONEXCLAMATION or MB_TOPMOST);
    result:=false;
   end;
  end;
end;

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive