Alexander (Sasha) Sirotkin wrote:

> Here is the problematic code, in case anybody cares to take a look:
> 
> for ( ListWindows( ) ) {
>     if ($_->{title} =~ /Firefox/) {
>         $hwnd = $_->{hwnd};
>         last;
>     }
> }
> Win32::GUI::SetForegroundWindow($hwnd);
> my $x = Win32::GUI::ScrollPos($hwnd, 0);
> printf("Scroll pos: " . $x . "\n");
> 
> Win32::GUI::Scroll($hwnd, 1, SB_PAGEDOWN);
> 
> ScrollPos() returns the same value no matter what is the scroll position 
> and scroll() does nothing...

You're calling these functions on the top-level window. The top-level 
window usually isn't a scrolled window.

The following code will dump the child controls of the Firefox window. 
You can use it as a base to write something to find the scrolled window, 
but it looks to me like it will be hard to find the one you want. (Run 
it and you'll see what I mean.)

use Win32::GUI;
use Win32::GUI::Constants qw(/^GW_/);
use strict;

my $hwnd = Win32::GUI::GetWindow(Win32::GUI::GetDesktopWindow, GW_CHILD);
while ($hwnd) {
        last if (Win32::GUI::Text($hwnd)=~/Firefox/);
        $hwnd = Win32::GUI::GetWindow($hwnd, GW_HWNDNEXT);
}

DumpWindows($hwnd);

sub DumpWindows {
        my ($ph, $l) = @_;
        
        print "\t" x $l;
        my $class = Win32::GUI::GetClassName($ph);
        my $text = Win32::GUI::Text($ph);
        print qq([$class] "$text"\n);

        my $ch = Win32::GUI::GetWindow($ph, GW_CHILD);
        while ($ch) {
                DumpWindows($ch, $l+1);
                $ch = Win32::GUI::GetWindow($ch, GW_HWNDNEXT);
        }
}


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to