Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to gather IE connection parameters

Posted on 2001-07-30
5
Medium Priority
?
191 Views
Last Modified: 2010-04-06
Hi, I 'd like to reuse the connection parameters as they were defined in IE

mainly, I want to know if
the connection is permanent of dial up
in case of dial up is there a default profile
is there a proxy and a proxy port
is a host defined and a host port

I'd like a solution that works with all versions of windows >= w95

I'd like a solution that does not need to have the administrator rights to be working or at least that would let me know that these righs are mandatory

I am not opposed to buy a component that des that if reliable and not too expensive

thanks in advance

Marc
0
Comment
Question by:mhervais
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:StevenB
ID: 6336248
 These are a few of the internet functions that I use:


function TryToConnectInternet : Cardinal;
var
  Modem, LAN, Proxy: Boolean;
begin
  If not GetOnline(Modem, LAN, Proxy) then Result := InternetAttemptConnect(0)
  else Result := 0;
end;

function GetOnline(var Modem, LAN, Proxy: Boolean): Boolean;
var
  flags: Cardinal;
begin
  Result:=InternetGetConnectedState(@flags,0);
  Modem:=flags and INTERNET_CONNECTION_MODEM>0;
  LAN:=flags and INTERNET_CONNECTION_LAN>0;
  Proxy:=flags and INTERNET_CONNECTION_PROXY>0;
end;

procedure GetDefaultProxyServer(var Server, ByPass: string; var Port: Integer);
const
  BUF_SIZE: DWORD = 500;
var
  ProxyInfo: PInternetProxyInfo;
  Buffer: Pointer;
begin
  GetMem(Buffer, BUF_SIZE);
  try
    if not InternetQueryOption(nil, INTERNET_OPTION_PROXY, Buffer, BUF_SIZE) then
      RaiseLastWin32Error;
    ProxyInfo := Buffer;
    ByPass := ProxyInfo^.lpszProxyBypass;
    if (ProxyInfo^.lpszProxy = '') then begin
      Server := '';
      Port := 0;
    end else with TStringTokenizer.Create(ProxyInfo^.lpszProxy, [':']) do try
      Server := NextToken;
      if HasMoreTokens then
        Port := StrToInt(NextToken)
      else
        Port := 0;
    finally
      Free;
    end;
  finally
    FreeMem(Buffer);
  end;
end;


  An overview of the Internet API can be found here:

http://shu.smolensk.su:8100/tech/wininet/general.htm#wininet_functions


  Hope this is of some initial help.

  Steven
0
 
LVL 4

Author Comment

by:mhervais
ID: 6338030
Sorry Steven, I did not receive an Email to inform me about this comment.

actually, Know about these functions (Did not try them though) because I figure that the can get me to know the parameters once the connction has been made (correct me if this is not true).

what I would like is to get the info before the connction has been made.

this might be a bad idea however because I could issue a connection whatever the parameters are.

however the question was about this.

I increase the poinst a bit in case more people would be interested to comment

regards, Marc

0
 
LVL 4

Accepted Solution

by:
StevenB earned 600 total points
ID: 6342865
 As far as your individual requirements go:

the connection is permanent or dial up - I'm pretty sure that InternetGetConnectedState (my GetOnline) function will return these values (LAN, Modem booleans) even if there is no current connection.
in case of dial up is there a default profile - I'm not sure about this one, but InternetAttemptConnect (my TryToConnectInternet) function certainly uses the default profile. I assume the value is lurking in the Registry somewhere, but I couldn't find it at a quick glance.
is there a proxy and a proxy port - InternetQueryOption(nil, INTERNET_OPTION_PROXY, Buffer, BUF_SIZE)  (My GetDefaultProxyServer) returns these values even when offline.

  Good luck with the rest, if I find anything I'll let you know. Much of the internet information by the way can also be found in the registry. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings is a good place to start looking.

  Steven
0
 
LVL 4

Author Comment

by:mhervais
ID: 6576718
thanks for your help

Sincerely, Marc
0
 
LVL 4

Expert Comment

by:StevenB
ID: 6589396
 No worries,

  Sorry about this by the way, I've only just noticed that the GetDefaultProxyServer function I sent you uses my TStringTokenizer object, so the code wouldn't work. The Tokenizer simply splits up a string by delimiters, in this case it splits the Port and the Server parts of the proxy information by splitting on the ":" character. Although I guess you worked that out :o)

  Steven
0

Featured Post

[Webinar] Protection from Cyberattacks

In this session, we’ll dive into the complexities of modern cyber threats and why only multi-vector protection can keep today’s businesses secure through the various stages of a cyberattack, across multiple vectors. Thursday September 14, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question