Sean Healy <[EMAIL PROTECTED]> writes:

> In the past, when I've had a loop that's expecially long, I've placed a 
> Win32::GUI::DoEvents call inside it so the window doesn't appear to be be 
> hanging.   I've noticed this effect when such a loop is going.  Do you by 
> chance have a loop with DoEvents in it?  (The WinXP thing may be simply a 
> coincidence.)

Yes.

I call an "idle" subroutine every 0.05 seconds (when there is no other
activity) and a "working" subroutine that's called when there is some
activity -- those are the only two places that DoEvents is called.  Both
the "idle" and "working" routines are also exactly the same at the
moment.  (This code was actually written by the author of
Win32::GUI::Loft and contributed to our project.)

I'm still learning how to use Win32::GUI myself, so if you have a fix
for me to try, please try to be specific.  Thanks.  :-)

------- start of cut text --------------
use constant WM_APP => 0x8000;                  #From winuser.h (Visual Studio)
use constant WM_EXITLOOP => WM_APP + 1;         #From GUI.xs

sub idle {
  my $self = shift;
  my ($win) = tglApp($tglWindow);

  local $SIG{__WARN__} = sub {};        #Supress warnings from Win32::GUI
  print "." if(::DEBUGGING >= 3);
  if($win->PeekMessage()) {
    $win->PostMessage(WM_EXITLOOP, 0, 0) for (0..100);
    Win32::GUI::Dialog();
  }

  Win32::GUI::DoEvents() while($win->PeekMessage());
  Win32::GUI::DoEvents();
  print "!" if(::DEBUGGING >= 3);

  return(1);
}
------- end ----------------------------

Dan

Reply via email to