How to change RAS connection number and modem init string withinapplication?

  • Thread starter Thread starter Clemens Chiba - Greentube I.E.S. AG
  • Start date Start date
C

Clemens Chiba - Greentube I.E.S. AG

Hi!

If the user has no LAN connection I have to dialup to the internet
in my application. This works fine, but in some case I'll have to
change the phone number (if the provider changes) and the additional
init string of the modem (for instance if the modem does not detect
the dial tone).

So, how do I do this?

I have not found the appropriate SDK functions (maybe I just use the
wrong search patterns in the help and in Google). Any hints?

Ciao and bye,
(:Clemens:)
 
Clemens,

Instead of doing the dialing yourself, I would use the functions from
the WinInet library to dial up an existing internet connection. Since it
seems that your app requires an internet connection, I think that it is safe
to say that one will be configured already on the machine.

I would use the InternetDial function in the WinInet library to
determine which internet connection to establish.

You could even use the InternetAutoDial function to use the default
connection that is set up.

Hope this helps.
 
Instead of doing the dialing yourself,

I do not dial myself but I use the RasDial function to use an
existing entry to establish the internet connection.
I would use the functions from the WinInet library to dial up
an existing internet connection. Since it seems that your app
requires an internet connection, I think that it is safe
to say that one will be configured already on the machine.

So InternetDial from this library does the same as RasDial, except
that I can use a different number in the call but I cannot set
a user and password anymore? But if the provider changes I need
all three values to be changed...

But today I've found out that I just need RasGet/SetEntryProperties
for my purposes (it seems, I was blind yesterday ;-) ), and after
some fights with the size of the RasEntry structure (I got errors
603 and 632) my code works fine. :-)
You could even use the InternetAutoDial function to use the
default connection that is set up.

Maybe I should have mentioned that the application is for a
TabletPC and that the users will work outdoors and sometimes
have to connect to the internet. That's why I have to change
the connection parameters if the provider changes. And the
user on the TabletPC must not be required to edit these
settings himself in the control panel.

Ciao and bye,
(:Clemens:)
 
But today I've found out that I just need RasGet/SetEntryProperties
for my purposes (it seems, I was blind yesterday ;-) ), and after
some fights with the size of the RasEntry structure (I got errors
603 and 632) my code works fine. :-)

I was even more blind:

I just found out that the RASDIALPARAMS structure has an entry
to overrule the phone number. I used an example from the internet,
so I've overseen this property between the MarshalAs attributes.
Ok, wasted some time, but learned something. ;-)

So the only thing that is left to do is to change the init string
of the modem. Do I also need some Ras functions to do this?

Ciao and bye,
(:Clemens:)
 
Back
Top