DelphiFAQ Home Search:
General :: Programming :: Delphi :: Network
Network (local network and Internet) programming under Windows with Delphi.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Detect an HTTP proxy from an Opera installation

For the uncommon situation that a user does not have IE installed, one could try to retrieve the proxy information from an Opera installation.

Opera software stores in the registry the directory in that the Opera browser is installed.

In this directory there is a configuration file 'Opera.ini' that contains a [PROXY] section. This section holds the required information.
The following handy routine shows how to code it:

procedure TForm1.FormCreate(Sender: TObject);
 var
   OperaDir : string;
   sResult  : string;
 begin
   // get Proxy host info from an Opera installation!
   with TRegistry.Create do
   begin
     sResult := '';
     RootKey := HKEY_CURRENT_USER;
     if OpenKey('\Software\Opera Software', false) then
     begin
       if ValueExists('Last Directory') then
       begin
         OperaDir := ReadString('Last Directory');
         SetLength(sResult, 128);
         SetLength(sResult,
         GetPrivateProfileString(
           'PROXY',
           'HTTP Server',
           '',
           @sResult[1],
           Length(sResult),
           PChar(OperaDir + '\opera.ini')));
       end;
     end;
     Free;
     if sResult <> '' then
       ShowMessage('Your http proxy is ' + sResult)
     else
       ShowMessage('Opera is not installed or no proxy found.');
   end;
 end;
You don't like the formatting? Check out SourceCoder then!
Generated 12:01:42 on Jun 17, 2019