473,473 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 10083
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.