http://qs321.pair.com?node_id=319263

Grygonos has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,

I have the following test script

#!/perl -w use strict; use Win32::Setupsup; my @windows; Win32::Setupsup::EnumWindows(\@windows); foreach(@windows) { my @proptoget = qw(focused pid); my %windowprop; Win32::Setupsup::GetWindowProperties($_,@proptoget,\%windowprop); foreach my $key (keys(%windowprop)) { print $key."-".$windowprop{$key}."\n"; } }
that should grab all the windows and grab the values of the focused and pid property. However when I run the script I get the following usage error: Usage: Win32::Setupsup::GetWindowProperties($window, @proptoget, \%windowprop) I do have a valid window reference because printing $_ gives me the handle. focused and pid are valid properties. I am passing the empty hash by reference. What am I missing?

Thanks a TON in advance...

Grygonos

Replies are listed 'Best First'.
Re: Win32::Setupsup quandry (guess)
by tye (Sage) on Jan 06, 2004 at 22:22 UTC

    I'd guess [correctly]1 that the usage message is just missing the \ before @proptoget. I'd check my guess but Win32::Setupsup is not [indexed]1 on CPAN so I gave up looking for it. Shame on the module author [for not following the documented conventions such that the module would get indexed (I presume2)]1.

                    - tye

    1 Updates

    2 I didn't download the *.zip, extract the files, read up on the conventions, etc. (I didn't go way out of my way to debug this module's problems.) If the module had been indexed in CPAN, then I could read the source (or documentation) directly with my browser (to name just a few of the advantages), so I don't feel too bad about being cheap with my time when it comes to "supporting" modules that can't manage to get that part right.

    I've been guilty of this myself, but I don't expect people to be generous with their time supporting my failures and I feel shame for it, so I'm not being a hypocrit. q-:

      tye, it is in CPAN, but something prevents it from showing up in any search.
      (reposted by request)

Re: Win32::Setupsup quandry
by boo_radley (Parson) on Jan 07, 2004 at 14:08 UTC

    Setupsup is a stone cold bitch an aggravating module to work with.
    There. I said it. It's difficult to find in CPAN, the documentation is lacking, its interface is funky, the error messages are lacking and it crashes in mysterious ways on different service packs. But it's the only game in town except for Win32::CtrlGui(a valiant effort there), which relies on setupsup; it's like putting a fresh coat of paint on a burning house.

    The answer to your question is to reference @proptoget : \@proptoget.

    And tye, it is in CPAN, but something prevents it from showing up in any search.

    Bonus Question : Guess what module I've been working with over the past two weeks?