I saw it, but it was Greek to me. ;-)  I do Perl, I haven't had the time to dive into 
C yet.

I am currently using Win32::RASE module and it seems to works sometimes but it usually 
croaks for no apparent reason.  It utilizes Win32::API to use the actual RAS API so 
you will undoubtedly understad it better than I do.

Source below:

use Win32::RASE;
use Getopt::Long;
use strict;

my %GAA_Config;

ParseArgs();

if ($GAA_Config{'Delete'} == 1) {
        RasDeleteEntry($GAA_Config{'name'});
}

my @GA_NetProtocols = qw/Ip/;

$GAA_Config{'NetProtocols'} = [EMAIL PROTECTED];
$GAA_Config{'FramingProtocol'} = "PPP";
$GAA_Config{'DeviceType'} = "modem";

my %GAA_Devices = RasEnumDevices() or die "Error";
#print map "\"$_\" of type \"$GAA_Devices{$_}\"\n", keys %GAA_Devices;

#print "\n";

foreach (keys %GAA_Devices) {
        if ($GAA_Devices{$_} eq "modem") {
                $GAA_Config{'DeviceName'} = $_;
        }
}

#foreach (keys %GAA_Config) {
        #print "$_ = $GAA_Config{$_}\n";
#}

#print "\n";

if (! IsEntry($GAA_Config{'name'}) && $GAA_Config{'LocalPhoneNumber'} ne "") {
        RasCreateEntry(\%GAA_Config);
}
elsif (IsEntry($GAA_Config{'name'}) && $GAA_Config{'LocalPhoneNumber'} ne "") {
        RasSetEntryProperties(\%GAA_Config);
}

#RasPrintEntryProperties ($GAA_Config{'name'});

RasDialDlg($GAA_Config{'name'});


sub ParseArgs {
        GetOptions ('dial=s' => \$GAA_Config{'LocalPhoneNumber'},
                        'del' => sub {$GAA_Config{'Delete'} = 1},
                        'name=s' => \$GAA_Config{'name'},
                        'h|?' => sub {$GAA_Config{'Help'} = 1},
        );
}

Any ideas?

Dax

*********** REPLY SEPARATOR  ***********

On 5/10/2004 at 6:01 PM John_Ramsden wrote:

>A few months ago I posted a complete C program that does all this.
>Try a search in the ActiveState perl mailing list with author
>equal to my email address.
>
>Cheers
>
>John R Ramsden
>
>
>-----Original Message-----
>From: Richard Morse [mailto:[EMAIL PROTECTED]
>Sent: 10 May 2004 14:54
>To: [EMAIL PROTECTED]
>Cc: [EMAIL PROTECTED]
>Subject: Re: Dial-up-Networking
>
>
>On 09 May 2004, at 10:33 AM, [EMAIL PROTECTED] wrote:
>
>> Is it possible to programatically create then dial a PPP connection 
>> via RAS on a Windows NT/2000/XP box?
>>
>> I need to be able to create the connection, turn 'off use default 
>> gateway on remote network', then dial the connection.
>>
>> Sample code would be very helpful.
>
>I'm sure there are modules that can do this, but I found the simplest 
>way (for my purposes) was just to use the RASDIAL command.  So I have a 
>command that looks like:
>
>       system("rasdial", $conn, $uname, $pw);
>
>which opens the connection, and then I use:
>
>       system("rasdial", $conn, '/DISCONNECT');
>
>to close the connection.
>
>HTH,
>Ricky
>
>_______________________________________________
>Perl-Win32-Users mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>Scanned by Messagelabs.




_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to