Link to home
Start Free TrialLog in
Avatar of timothy1
timothy1

asked on

Using MS Comm Control

Can anyone tell me or give me the code to add to a program that will allow the program to use the Dial-up settings in the Internet Properties of windows 95 so that the program will dial the users ISP and sign on with their login and password?
ASKER CERTIFIED SOLUTION
Avatar of MrOBrian
MrOBrian

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of timothy1
timothy1

ASKER

Any hints on how to implement said code?
Well, what I did was put all the Declare and Global lines in a Module.  The in the form.load event of my project I put all the stuff from Dim to End If, which checks the current connection state and attempts to connect if not connected.  The InternetAutoDialHangup I put in my FileExit routine just before Ending the program, but it can be put anywhere you want to hang up the connection.  I've tried it with a modem and on a networked computer without a modem, it works great, though I haven't really played with the dwFlag to see if it works, my program just wanted to know if it had any kind of connection.
Also be careful with the above code, I just noticed that some of lines were split in two (at least on my screen...) so you might need to do some reconstruction if you cut-and-paste.
Okay it worked, but I noticed that when I stepped through the program and it got to the:

If InternetGetConnectedState(dwFlag, 0) Then
 Select Case dwFlag
 Case INTERNET_CONNECTION_MODEM
  'Connected via Modem
 Case INTERNET_CONNECTION_LAN
  'Connected via LAN
 Case INTERNET_CONNECTION_PROXY
  'Connected via Proxy
 End Select
Else
 InternetAutodial INTERNET_AUTODIAL_FORCE_UNATTENDED, 0
End If

It always jumped to the Else statement. Am I supposed to replace the 'Connected via modem,lan or proxy with something like:

InternetAutodial INTERNET_CONNECTION_MODEM, 0

or whatever the case maybe?
No, you should leave it as INTERNET_AUTODIAL_FORCE_UNATTENDED for the InternetAutodial...  I am really not sure about the InternetGetConnectedState, I think it is supposed to return a true/false value, but it is possible that it returns a long, which might evaluate to one of the INTERNET_CONNECTION_* things...  I haven't used it enough to figure out what all it does.