Delphi .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
Detect an HTTP proxy from an Opera installation
This article has not been rated yet. After reading, feel free to leave comments and 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!
Comments:
|