Hirmke Michael wrote:
> Hi,
>
> I intend to use WIn32::GUI mainly to control existing windows and
programs.
> So far I get handles for existing windows, can SetForegroundWindow, can
> GetPerlWindow, Hide and Show any of them.
> But when I try
>
>   $hWnd = GUI::FindWindow( '', $sTitle );
>   GUI::SetForegroundWindow( $hWnd );
>   $hWnd->GUI::Resize( $iWidth, $iHeight );
>
> I get
> "Can't call method "GUI::Resize" without a package or object
> reference"

the syntax is wrong, try this one:

    GUI::Resize( $hWnd, $iWidth, $iHeight );

you need to call the function as if it was 'standalone' and
pass the obtained handle as the first parameter.

basically, whenever you invoke a method on an object, the object
itself is passed as the first parameter; the following two lines
are completely equivalent:

    $Window->Resize( 100, 100 );
    Win32::GUI::Resize( $Window, 100, 100 );

but the first one is obviously more practical ;-)
when you work with existing windows, they're not object but mere
numerical values (handles), so the "->" it's a no-no.
always use the second form with them.

cheers,
Aldo

__END__
# Aldo Calpini
%_ = split undef, join ' ', qw(fahokem
xritajbugne csuctawer jhdtlrnpqloevkshpr
); print map $_{$_}, sort keys %_;





Reply via email to