|
From: christopher s. <chr...@ya...> - 2001-01-31 03:44:49
|
hi all
Please tell me if this question is totally off topic here .
If it is , can anyone suggest a suitable mailing list for this question
I thought since the finest win32 api minds hang out here I would post it =
here
The code is taken from the actual example
---------------------------------------------------------------------
$|=3D1;
use Win32::RASE;
print "\nI'm dialing via the first RAS entry: $first_RAS_entry\n\n";
($UserName, $Password) =3D RasGetUserPwd($first_RAS_entry)
or die Win32::RASE::FormatMessage;
print "UserName:";
!$UserName ? chomp($UserName=3D<>) : print "$UserName\n";
print "Password:";
!$Password ? chomp($Password=3D<>) : print "$Password\n";
$hrasconn =3D RasDial($first_RAS_entry, undef , $UserName, $Password)
or die Win32::RASE::FormatMessage;
#($err, $status) =3D RasDial("CLICK", "DP 110-6511" , $UserName, =
$Password,undef,undef)
# or die Win32::RASE::FormatMessage;
print "Connected, \$hrasconn=3D$hrasconn\n";
print "\n\n------next line---\n\n";
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D don't edit under this =
line =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sub FindOpenedFolders () {
# returns array of hwnd's of the opened folders
my $findAfter =3D 0;
my @folders;
$FindWindowEx ||=3D new Win32::API("user32", "FindWindowEx", =
[N,N,P,P], N);
while($findAfter =3D $FindWindowEx->Call(0, $findAfter, =
"CabinetWClass", 0)) {
push @folders, $findAfter;
}
$findAfter =3D 0;
while($findAfter =3D $FindWindowEx->Call(0, $findAfter, =
"ExploreWClass", 0)) {
push @folders, $findAfter;
}
@folders;
}
sub CloseWindow ($) {
# arg - hwnd
$PostMessage ||=3D new Win32::API("user32", "PostMessage", [N,N,N,N], =
I);
$WN_CLOSE =3D 0x10;
$PostMessage->Call(shift, $WN_CLOSE, 0, 0);
}
BEGIN {
require Win32::API;
unless ($hwnd =3D (FindOpenedFolders())[0]) {
system 'start explorer /n,C:\\';
$start_time =3D time;
while (!($hwnd =3D (FindOpenedFolders())[0]) && $start_time+3 < =
time) {}
$hwnd or die "Could not open C:\\ window\n";
$hwnd_opened =3D 1;
}
$first_RAS_entry =3D (RasEnumEntries())[0]
or die "No one RAS entry were found\n";
}
END { CloseWindow($hwnd) if $hwnd_opened }
The above code when run , starts dialing right away ...
but I want sample codes for=20
1) invoking the default original windows DUN dialog .
2) to check whether the user is connected to the internet
3) to disconnet from internet
any help will be greatly appreciated
or should I use any other perl module ?
chris
www.perl-resume.com
|