?
Solved

Detection Dial up or Lan

Posted on 2001-08-04
4
Medium Priority
?
184 Views
Last Modified: 2010-04-06
I need some help here. I wrote a program that uses FPiettes Ping (looking for internetconnection) and SMTP component (email some data to a user).

The problem : All of the above works fine on a computer with a constant internet connection using lan/cable, but there _can_ be users with a dial-up connection! So I have to find out if they have a lan/cable or dialup connection and if they do have a dialup I need to pop-up the dialup window.., but how?

I am looking for an answer all day now so please help me out.
0
Comment
Question by:DerkEimers
[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
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 180 total points
ID: 6351288
Hello


  this procedure will determine the connetion type:
 
uses wininet;

Function ConnectionKind :boolean;
var
  flags: dword;
begin
  Result := InternetGetConnectedState(@flags, 0);
  if Result then
  begin
    if (flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM then
    begin
      showmessage('Modem');
    end;
    if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then
    begin
      showmessage('LAN');
    end;
    if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then
    begin
      showmessage('Proxy');
    end;
    if (flags and INTERNET_CONNECTION_MODEM_BUSY)=INTERNET_CONNECTION_MODEM_BUSY then
    begin
      showmessage('Modem Busy');
    end;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ConnectionKind;
end;

//==========
And this one to dial up the default connection


Uses Registry, windows;

Function DUNDialDefault(Hide : Boolean) : Boolean;
// Show or hide the dial-up dialog
var Reg : TRegistry;
var TempResult : Boolean;
var Name, con : String;
var ASW : Integer;
begin
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\RemoteAccess', False) then
  begin
    TempResult := True;
    Name := Reg.ReadString('Default');
  end
else begin
tempresult := False;
end;
Reg.Free;
if TempResult = True then
  begin
    if Hide = True then ASW := SW_HIDE
    else ASW := SW_SHOWDEFAULT;
    con := 'rnaui.dll,RnaDial ' + Name;
    ShellExecute(0, nil, 'rundll32.exe' , PChar
                  (con), 'C:\windows\', ASW);
end;
Result := tempResult;
end;

I got them from delphi3000:
http://www.delphi3000.com/articles/article_1031.asp
http://www.delphi3000.com/articles/article_1729.asp

Best regards
Mohammed Nasman
0
 

Author Comment

by:DerkEimers
ID: 6351593
I am not happy with the registry solution and how about Windows NT4? That's not going to work...
0
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6351656
listening... :-)
0
 

Author Comment

by:DerkEimers
ID: 6352017
It's a correct answer.. And I'm a fair guy...
0

Featured Post

Industry Leaders: 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

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…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

777 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