Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to gather IE connection parameters

Posted on 2001-07-30
5
Medium Priority
?
195 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
  • 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] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2
Suggested Courses

926 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