Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Win32::Setupsup menu item enumeration
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, \@children);

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;

Report this thread to moderator Post Follow-up to this message
Old Post
Peter Rabbitson
03-30-05 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:04 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.