Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dial-up connection

Status
Not open for further replies.

rianeiromiron

Programmer
Jul 1, 2001
151
GT
Hi everyone?

Does anyone know how to determine if a dial-up connection is working/running/active?

The case is that I need to activate a dial-up connection, (using APIs winexec) but I need to know if the connection was succesfull, and if it wasn't, I will re-run the link until the connection is made.

Any Ideas?

Thank you
 
You can accomplish what you want with RasDial

here are the declares

DECLARE RasHangUp IN RASAPI32 integer hrasconn
* Declare API function to dial remote system.
Declare Integer RasGetConnectStatus in RasAPI32;
integer HRASCONN, ; && connection handle
string @RasGetConnectStatus && structure to recieve connection info
* Declare API function to dial remote system.
Declare Integer RasDial in RasAPI32 ;
String lpRasDialExtensions, ;
String lpszPhonebook, ;
String lpRasDialParams, ;
Integer dwNotifierType, ;
Integer lpvNotifier, ;
Integer @lphRasConn

DECLARE INTEGER RasEnumEntries IN rasapi32 ;
STRING reserved,;
STRING phonebook,;
STRING @rasentry,;
INTEGER @lnSize,;
INTEGER @lnEntries

DECLARE INTEGER RasGetEntryProperties IN rasapi32 ;
string @lpszPhonebook,;
string @lpszEntry,;
string @lpRasEntry,;
integer @lpdwEntryInfoSize,;
integer lpbDeviceInfo,;
integer lpdwDeviceInfoSize

DECLARE INTEGER RasGetEntryDialParams IN rasapi32 ;
string lpszPhoneBook,;
string @lpRasDialParams,;
integer @lpfPassword
thisform.handle = fcreate("a:\rasdial.txt")

I have a test form that I have used for testing. It has for buttons:
get dial up entries that are defined on the system
dial the entry
status of connection
hangup

I you need it I will be glad to send it if you provide a email address. Attitude is Everything
 
Dear Danceman

Thank you for your response. I would appreciate if you send me your test form because it was difficult for me to understand all of the parameters in the functions involved.
rianeiromiron@yahoo.com


I used another aproach:

The reason I needed to know if a connection was "running" was that if it wasn't I would redial until I could get a connection. Instead, I used a function to automatically dial the default connection. This function returns 0 (zero) if the connection was unsuccessfull or a value > 0 if it was. So, if I wasn't able to get the connection I waited 5 seconds and tried again until the connection was done or a user interfered and pushed a "Quit trying" command button. I took the code directly from news2news.com (interesting place by the way, it's helped me many times) and it goes like this:

* Source: * Author: * authorid=3&associd=478&assoctype=3

#DEFINE INTERNET_AUTODIAL_FORCE_ONLINE 1
#DEFINE INTERNET_AUTODIAL_FORCE_UNATTENDED 2

DECLARE INTEGER InternetAutodial IN wininet.dll;
INTEGER dwFlags, INTEGER dwReserved

DECLARE INTEGER InternetAutodialHangup IN wininet.dll;
INTEGER dwReserved

* To prompt the user to connect to the Net
= InternetAutodial (INTERNET_AUTODIAL_FORCE_ONLINE, 0)

* To automatically start dialling
= InternetAutodial (INTERNET_AUTODIAL_FORCE_UNATTENDED, 0)

* To disconnect an automatically dialled connection
= InternetAutodialHangup(0)
 
Hi danceman,
May I has a copy of your test form, please? My email address is peter.wu@draeger.com.au.

Thanks.

Peter
 
Hi danceman,
I will appreciate if you send me your test form . It will be a big help for me.
brattwild@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top