in reply to The power of Perl and Win32::GUI

Avoid repeated output when mouse stays over a colour:
use Win32::GUI; $screen = new Win32::GUI::DC("DISPLAY"); while(1) { ($x,$y) = Win32::GUI::GetCursorPos(); $color = $screen->GetPixel($x,$y); next if $color eq $last; $last = $color; printf ("%06X\n", $color); sleep 1; }


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: The power of Perl and Win32::GUI
by NetWallah (Canon) on Aug 15, 2005 at 21:19 UTC
    On my PC, I save 50% CPU (1 % vs 52%) if I move the "sleep 1" as the first statement in the "while(1){" loop, with very minimal(un-noticable for practical purposes) loss in responsiveness.

         "Income tax returns are the most imaginative fiction being written today." -- Herman Wouk