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
---------------------------------------------------------------------

$|=1;
use Win32::RASE;

print "\nI'm dialing via the first RAS entry: $first_RAS_entry\n\n";

($UserName, $Password) = RasGetUserPwd($first_RAS_entry)
 or die Win32::RASE::FormatMessage;

print "UserName:";
!$UserName ? chomp($UserName=<>) : print "$UserName\n";

print "Password:";
!$Password ? chomp($Password=<>) : print "$Password\n";


$hrasconn = RasDial($first_RAS_entry, undef , $UserName, $Password)
 or die Win32::RASE::FormatMessage;

#($err, $status) = RasDial("CLICK", "DP 110-6511" , $UserName, 
$Password,undef,undef)
# or die Win32::RASE::FormatMessage;

print "Connected, \$hrasconn=$hrasconn\n";
print "\n\n------next line---\n\n";


#=============== don't edit under this line ==============
sub FindOpenedFolders () {
# returns array of hwnd's of the opened folders
  my $findAfter = 0;
  my @folders;
  $FindWindowEx ||= new Win32::API("user32", "FindWindowEx", [N,N,P,P], N);

  while($findAfter = $FindWindowEx->Call(0, $findAfter, "CabinetWClass", 0)) {
     push @folders, $findAfter;
  }

  $findAfter = 0;
  while($findAfter = $FindWindowEx->Call(0, $findAfter, "ExploreWClass", 0)) {
     push @folders, $findAfter;
  }
  @folders;
}

sub CloseWindow ($) {
# arg - hwnd
  $PostMessage ||= new Win32::API("user32", "PostMessage", [N,N,N,N], I);
  $WN_CLOSE = 0x10;

  $PostMessage->Call(shift, $WN_CLOSE, 0, 0);
}

BEGIN {
  require Win32::API;

  unless ($hwnd = (FindOpenedFolders())[0]) {
    system 'start explorer /n,C:\\';
    $start_time = time;
    while (!($hwnd = (FindOpenedFolders())[0]) && $start_time+3 < time) {}

    $hwnd or die "Could not open C:\\ window\n";
    $hwnd_opened = 1;
  }

  $first_RAS_entry = (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 

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








Reply via email to