473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Creating a dialup connection


Hi, just wondering if anyone out there has created a dialup connection
using C# or other dot net language. Is the rasdial.dll the only way to
do this? Where can I find code examples to create connections?

If you know of a source or have some code, your response would be
appreiciated.

Code hard,
Matt
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
1 10077
Hi,
Has anyone written any code that invokes TAPI to make calls?
Thanks
John

"Mark Relly" <ma**@mslnet.co.uk> wrote in message
news:0d****************************@phx.gbl...
//Matt
//This is a class I have done recently
//its not perfect and far from finished
//but I hope its some help
//I'm currently trying to dial a specific number
//if you come accross how I'd love to know
//rellymr

using System;
using System.Runtime.InteropServices;
public class DialUp {

[DllImport("wininet.dll",
SetLastError=true)]
public static extern int
InternetAttemptConnect(uint res);

[DllImport("wininet.dll",
SetLastError=true)]
public static extern int
InternetAutodialHangup(uint res);

[DllImport("wininet.dll",
SetLastError=true)]
public static extern bool
InternetGetConnectedState(long flags,long reserved);

[DllImport("wininet.dll",
SetLastError=true)]
public static extern int InternetDial(int
parent,string connectionid,int flags,int connection,int
reserved);

static long l1 = 0;
private static long RESERVED = 0;

public DialUp() {
}

public static void Dial() {
int hresult;
if((hresult =
InternetAttemptConnect(0)) != 0)
throw new COMException
("dial up", hresult);
}

public static void DialNumber(int number) {
int hresult;
hresult = InternetDial
(0,"",0,number,RESERVED);
}

public static void HangUp() {
int hresult;
if((hresult =
InternetAutodialHangup(0)) != 0)
throw new COMException
("hangup", hresult);
}

public static bool ConnectionState() {
bool hresult;
hresult = InternetGetConnectedState
(l1,RESERVED);
//Console.WriteLine
("Conenction:\t"+hresult);
return hresult;
}

public static string ConnectionType() {
bool hresult;
string str = null;
l1 = InternetGetConnectedState
(l1,RESERVED);
switch (l1) {
case (0):

str="INTERNET_CONNECTION_OFFLINE";
break;
case (1):

str="INTERNET_CONNECTION_MODEM";
break;
case (2):

str="INTERNET_CONNECTION_LAN";
break;
case (4):

str="INTERNET_CONNECTION_PROXY";
break;
case (8):

str="INTERNET_CONNECTION_MODEM_BUSY";
break;
}
return str;
}
}

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SPD | last post by:
I've been researching this issue with little luck. Here's the situation: We have a few users on slow dialup connections who are posting data from forms. Frequently, they get script timeout...
5
by: jen_designs | last post by:
How do I create custom controls for an embeded video. I need stop, play, pause, etc. Any thoughts?
0
by: Joe Saliba | last post by:
is it possible to create a dialup connection thru vb(or vb scripts) with all of its properties ?? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in...
2
by: himu | last post by:
Hi :idea: , I am looking for some input on “Dialup Connectivity” in .Net My scenario being I will have a config file containing the parameters required for modem connection like the phone...
3
by: Harry Simpson | last post by:
I've got an aspnet page that is primarily a datagrid within a DIV that loads a dataset from a SQLServer call on load. It returns about 187 records. The kicker is that when i access this page...
2
by: cr113 | last post by:
I want to write program that will establish a dialup connection from a standalone pc to a private network and then copy files. The program will reside on the standalone pc. Is there .NET object for...
0
by: yom | last post by:
Hi all. I am having some troubles with an application that has to open a dialup up connection. I am using the Ras API RasDial to call the remote modem an all works properly. I am also able to...
1
by: den 2005 | last post by:
Hi everybody, How do you monitor the connection if it is still open or close for a dial up and internet RAS connection? I used both dialup and vpn RAS. The dialup is for modem connection and vpn...
0
by: Tahir | last post by:
HelpTopic: Import/Restore/Transfer, Only Updated/Changed/New Values Between Two SQL Servers Over Dialup Connection. -- Hi All, I need a little helping hand/Tips: The Problem & Situation: One...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.