Hi everyone, I got stuck with the inability of Setupsup::EnumChildWindows or
Setupsup::GetWindowProperties to generate a list of available choices in a
regular menu (the one you get when you do 'open file' for example). I do not
know a thing about MFC, and perl/windows integration is not as well
documented as it could have been.  So here is my situation - I have a list
of 5 items in this menu box. The highlight is placed on the item which was
opened last - hence it is arbitrarily random. This can be somewhat avoided
by sending an excessive number of UP arrows that will make sure I am at the
first one and then do the descend of N steps. However it is possible that in
the future the amount of items will change (e.g. 6 or 7 or even more) which
will render the subroutine useless unless new values are plugged in for each
items position. So the question is if there is a way that I am overlooking
to dump the entire list in an array. Then finding the index of the text in 
question and descend index times from the top and then hit enter would be 
trivial. I am attaching a piece of code and the output it produced - maybe 
it will help someone to give me a better answer:

Thank you

Peter


#======= Code ========
# $active_window is the handle of the main window of the app
# there are 4 visible fields, the upper left (company name) with 
# the list in question, then a directory tree next to it, two 
# drop down menus on the bottom, and ok, cancel, help, network 
# buttons on the right

my @children;

EnumChildWindows ($active_window, [EMAIL PROTECTED]);

foreach my $win (@children) {
                
        my %prop;

        print "** $win\n";

        GetWindowProperties($win, ['menu', 'text', 'wndproc', 'classmenu'], 
\%prop);
                
        print Dumper (%prop);
        print "\n";
}



# ==== Output =====

** 19399254
$VAR1 = 'text';
$VAR2 = '';
$VAR3 = 'menu';
$VAR4 = 1039;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 25821678
$VAR1 = 'text';
$VAR2 = 'Company &Name';
$VAR3 = 'menu';
$VAR4 = 1090;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 20251090
$VAR1 = 'text';
$VAR2 = '';
$VAR3 = 'menu';
$VAR4 = 1152;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 22610276
$VAR1 = 'text';
$VAR2 = '';
$VAR3 = 'menu';
$VAR4 = 1120;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 15598048
$VAR1 = 'text';
$VAR2 = '&Directories:';
$VAR3 = 'menu';
$VAR4 = 65535;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 18612702
$VAR1 = 'text';
$VAR2 = 'z:\\ph77px~s';
$VAR3 = 'menu';
$VAR4 = 1088;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 23069314
$VAR1 = 'text';
$VAR2 = '';
$VAR3 = 'menu';
$VAR4 = 1121;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 15401522
$VAR1 = 'text';
$VAR2 = 'List Companies of &Type:';
$VAR3 = 'menu';
$VAR4 = 1089;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 2359640
$VAR1 = 'text';
$VAR2 = '';
$VAR3 = 'menu';
$VAR4 = 1136;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 21299780
$VAR1 = 'text';
$VAR2 = 'Dri&ves:';
$VAR3 = 'menu';
$VAR4 = 1091;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 20120036
$VAR1 = 'text';
$VAR2 = '';
$VAR3 = 'menu';
$VAR4 = 1137;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 27328916
$VAR1 = 'text';
$VAR2 = '&OK';
$VAR3 = 'menu';
$VAR4 = 1;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 20644394
$VAR1 = 'text';
$VAR2 = '&Cancel';
$VAR3 = 'menu';
$VAR4 = 2;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 22938002
$VAR1 = 'text';
$VAR2 = 'Network...';
$VAR3 = 'menu';
$VAR4 = 1037;
$VAR5 = 'classmenu';
$VAR6 = 0;

** 18219564
$VAR1 = 'text';
$VAR2 = '&Help';
$VAR3 = 'menu';
$VAR4 = 9;
$VAR5 = 'classmenu';
$VAR6 = 0;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to