in reply to How to Resize a Window in M$ Windows?

Since you have a handle, not a Win32::GUI object, you can't call Resize() as a method, you have to call it as a function, passing the handle as the first argument. Example:

Win32::GUI::Resize($handle, $new_width, $new_height);

The same goes for most other methods in the Win32::GUI module.

Replies are listed 'Best First'.
Re^2: How to Resize a Window in M$ Windows?
by Anonymous Monk on Feb 10, 2011 at 08:34 UTC
    But he does bless the handle :) Based on
    $ perl -MDDS -MWin32::GUI -e " Dump( Win32::GUI::Window->new ) " $Win32_GUI_Window1 = bless( { -accel => 0, -handle => 1442212, -name => '#118a214', -type => 0 }, 'Win32::GUI::Window' );
    I would use
    $PuttyInfo->{'Window'} = bless( { -accel => 0, -handle => $PuttyInfo->{'WindowHandle'}, -name => 'something', -type => 0 }, 'Win32::GUI::Window' ); $PuttyInfo->{'Window'}->Resize(($ScrWidth * .5), $ScrHeight);

      My own experience has taught me not to try create a Win32::GUI object from a handle, as you might do something wrong, or there might be other things at work that you might miss (I think the module actually ties the hash object to allow some magic). Best just let the module look after all that. The function style works fine, albeit a little cumbersome.

        My own experience has taught me not to try create a Win32::GUI object from a handle, as you might do something wrong, or there might be other things at work that you might miss (I think the module actually ties the hash object to allow some magic). Best just let the module look after all that.

        I've been doing this for a while, and there really isn't anything that can go wrong. If you know different, I would appreciate an actual example over caution :)