I might be slow to learn but

Actually what Im concerned about is the while loop

How do I get out of the while loop ?

while ( ($status, $status_text) = RasGetConnectStatus($hrasconn) ) {
}

once the control goes into this loop how it is going to get out ?

Or are these kinds of daemons possible in Win32::GUI ?


chris
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Wednesday, February 14, 2001 3:22 PM
Subject: Re: [perl-win32-gui-users] looping in win32 GUI


Chris,

I guess what you want to do is have a status window on
which you can display the status text from the RASE call?
If that's the case you can do something like this

use Win32::GUI;

my $Win = new Win32::GUI::Window(
      -left   => 341,
      -top    => 218,
      -width  => 300,
      -height => 86,
      -name   => "Win",
      -text   => "RAS Status"
      );

$Win->AddLabel(
       -text    => "  ",
       -name    => "Label",
       -left    => 5,
       -top     => 5,
       -width   => 280,
       -height  => 48,
      );

sub display {           #   Update status text
   my $text=shift;
   $Win->Show();
   $Win->BringWindowToTop();
   $Win->Refresh();
   $Win->Label->Text($text);
   $Win->Label->Update();
}

and use display instead of the print in your code
sample.

If you have other windows that you want to run in
the foreground you might want to consider not using
$Win->BringWindowToTop().

Hope that helps.

Kev.




[EMAIL PROTECTED] on 14/02/2001 13:29:22
To: perl-win32-gui-users@lists.sourceforge.net @ INTERNET
cc:

Subject: [perl-win32-gui-users] looping in win32 GUI

$|=1;
use Win32::RASE;
eval "use Time::HiRes qw(sleep)";
$hrasconn = (RasEnumConnections())[1];
$old_status = -1;
while ( ($status, $status_text) = RasGetConnectStatus($hrasconn) ) {
   if ($status != $old_status) {
       print "$status: $status_text\n";
       $old_status =  $status;
   }
   sleep ($@ ? 1 : 0.01);
}
# error 6 - Invalid handle
($err = Win32::RASE::GetLastError) != 6 and die
Win32::RASE::FormatMessage($err);
exit;


The above code goes into a while loop and constantly checks for the internet
connection and prints connected or disconnected as appropriate

Now my question is how do I use this loop in Win32 GUI

suppose I use the above loop as it is control , will NOT be transferred to
any other part of the program...

I know that Win32::GUI::Dialog(); actually goes into an indefinite loop
looking for keypresses etc

How can I integrate the while loop also into theWin32::GUI::Dialog(); loop ?


hope Im clear with my question if NOT I will elaborate

Thanks

chris
www.perl-resume.com





_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users





Reply via email to