Solved

How to gather IE connection parameters

Posted on 2001-07-30
5
189 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 150 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month6 days, 1 hour left to enroll

627 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