473,597 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
+ 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 10094
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("wini net.dll",
SetLastError=tr ue)]
public static extern int
InternetAttempt Connect(uint res);

[DllImport("wini net.dll",
SetLastError=tr ue)]
public static extern int
InternetAutodia lHangup(uint res);

[DllImport("wini net.dll",
SetLastError=tr ue)]
public static extern bool
InternetGetConn ectedState(long flags,long reserved);

[DllImport("wini net.dll",
SetLastError=tr ue)]
public static extern int InternetDial(in t
parent,string connectionid,in t flags,int connection,int
reserved);

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

public DialUp() {
}

public static void Dial() {
int hresult;
if((hresult =
InternetAttempt Connect(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 =
InternetAutodia lHangup(0)) != 0)
throw new COMException
("hangup", hresult);
}

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

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

str="INTERNET_C ONNECTION_OFFLI NE";
break;
case (1):

str="INTERNET_C ONNECTION_MODEM ";
break;
case (2):

str="INTERNET_C ONNECTION_LAN";
break;
case (4):

str="INTERNET_C ONNECTION_PROXY ";
break;
case (8):

str="INTERNET_C ONNECTION_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
1340
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 errors. We've gotten timeouts from users with faster connections as well, so I suspected that the overall load is overtaxing the server. But it does seem to be more frequent with dialup users posting relatively large (>10K) worth of data from forms....
5
5452
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
1173
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 USENET...get rewarded for it!
2
1900
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 number, data bit, baud rate, etc. Here I have instantiate the connection and send a string to the server (machine I connect to) and where I will receive a message once the string has been received.
3
1286
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 from a broadband connection, it loads just fine. But when i try to access the page from a dialup 56 kbps, it says the page cannot be accessed error -1 and doesn't load the page at all.
2
1335
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 this? API call? Thanks! Chuck.
0
1545
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 close the connection by calling the RasHangUp API: in this case i can redial the number and open a new connection. The problem comes out when the line is busy or when any other error is
1
2532
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 ras is for remote internet connection. What methods to use and how to use them? I used RASDial and RasHangUp functions to connect and disconnect. Can anyone exactly show me codes? I am using C#. Thanks. dennis --
0
1099
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 of the client have 7 Branches in different parts of country. Now on Month End Closings, database backups are sent on CDs through Express Mail, which usually gets to the head office a bit late and due to that, many Post-Month-End Process in head...
0
7886
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8035
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2404
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 we have to send another system
0
1238
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.