I think you may be looking in the wrong direction! The key to updating is in handling the Paint event triggered whenever Windows thinks a window (or part thereof) should be repainted. This covers the situations you describe. Win32::GUI uses an approach that means you must redraw *everything* that is displayed. In theory, you can get away with redrawing just part of the window, but it is much easier to simply re-run the whole display routine each time.
In the code snippets below, showall(); does all the drawing, which in my program is quite an extensive operation. Nevertheless, the update is very smooth and looks just like real Windows - and better than some commercial programs I have encountered. NB. The $dc->Validate(); is very important. ------------------------------------------- # this is a graphic "canvas" where everything is displayed $Win2 = new Win32::GUI::Graphic( -parent,$Win, -name, 'workwin', -left, 0, -top, $win2top, -height, $Win->Height(), -width, $Win->Width(), ); # this is the DC for the graphic my $dc = $Win2->GetDC; # this fires every time window needs repainting # (Windows sends the notification) sub workwin_Paint { showall(); # all the display activity $dc->Validate(); # very important } ------------------------------- Alan Original message: From: Jonathan Southwick <[EMAIL PROTECTED]> Subject: [perl-win32-gui-users] need subroutine to run when Window gets focus Is there any way to get a routine to run when a window is brought to the top or receives focus? That seems to be the only way I can get a DC object to refresh after it is covered by another window. Jonathan