DelphiFAQ Home Search:

Detect an HTTP proxy from an Opera installation

 

comments1 comments. Current rating: 3 stars (1 votes). Leave comments and/ or rate it.

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!
Content-type: text/html

Comments:

2009-02-05, 06:59:32
anonymous from Iran  
rating
hi

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: