Pierre and other who have given me help:
Since writing this message I have stumbled across the Win32::SetupSup
module. Using this I am able to do the modal window plus kill window, min
and max window, hide window in system tray, print all windows and other
stuff that is not all that useful. I did not receive a lot of response on
this so I am wondering if using Perl and TK on a windows platform is
somewhere on the fringe of perl use?
Anyway, I included the code that I cobbles together just in case others find
themselves in the same boat, or if their are some improvements that I should
make.
use Win32::Setupsup;
use strict;
use diagnostics;
use Win32::API;
my @proc;
my @threads;
my @windowlist;
Win32::Setupsup::EnumWindows(\@windowlist);
my ($action, $search_text, $other) = ('no_action','XXXXXXXX','none');
($action, $search_text, $other) = @ARGV;
my $text='';
#my %prop = ();
my $SetWindowPos = new Win32::API('user32','SetWindowPos',
['N','N','N','N','N','N','N'], 'N');
if (not defined $SetWindowPos) {
die "Can't import SetWindowPos: $!\n";
}
foreach my $item (@windowlist) {
my %prop = ();
Win32::Setupsup::GetWindowText($item,\$text);
if ($text =~ /$search_text/i) {
next if ($text =~ /^Command|^Dos Prompt/);
Win32::Setupsup::GetWindowProperties($item,['pid'],\%prop);
if ($action eq 'print') {
print "found $item = $text\n";
}
elsif ($action eq 'kill') {
print "killing $prop{'pid'} $text\n";
Win32::Setupsup::KillProcess($prop{'pid'});
if (defined $other and $other ne 'all') {
exit 1;
}
}
elsif ($action eq 'pid') {
print "window = $item, pid = $prop{'pid'} - $text\n";
}
elsif ($action eq 'is_running') {
print "$prop{'pid'} $text is running\n";
exit 1;
}
elsif ($action eq 'focus') {
print "this is where we set focus for $text\n";
my %new_prop = ('iconic',0);
Win32::Setupsup::SetWindowProperties($item,\%new_prop);
Win32::Setupsup::SetFocus($item);
exit 1;
}
elsif ($action eq 'float') {
print "this is where we float $text\n";
my $ret_code = $SetWindowPos->Call($item,-1,0,0,0,0,67);
exit 1;
}
elsif ($action eq 'forground') {
print "this is where we set move window to forground for
$text\n";
my %new_prop = ('forground',1);
Win32::Setupsup::SetWindowProperties($item,\%new_prop);
# Win32::Setupsup::SetFocus($item);
exit 1;
}
elsif ($action eq 'show') {
print "this is where we set show windows for $text\n";
my %new_prop = ('visible',1);
Win32::Setupsup::SetWindowProperties($item,\%new_prop);
if (defined $other and $other ne 'all') {
exit 1;
}
}
elsif ($action eq 'hide') {
print "this is where we set hide windows for $text\n";
my %new_prop = ('visible',0);
Win32::Setupsup::SetWindowProperties($item,\%new_prop);
if (defined $other and $other ne 'all') {
exit 1;
}
}
elsif ($action eq 'minimize') {
print "this is where we set minimize for $text\n";
my %new_prop = ('iconic',1);
Win32::Setupsup::SetWindowProperties($item,\%new_prop);
if (defined $other and $other ne 'all') {
exit 1;
}
}
elsif ($action eq 'maximize') {
print "this is where we set maximize for $text\n";
my %new_prop = ('iconic',0);
Win32::Setupsup::SetWindowProperties($item,\%new_prop);
if (defined $other and $other ne 'all') {
exit 1;
}
}
elsif ($action eq 'sendkeys') {
print "this is where we send keystrokes to $prop{'pid'}
$text\n";
Win32::Setupsup::SendKeys($item,$other,1,500);
}
elsif ($action eq 'title') {
print "this is where we set title for $text\n";
Win32::Setupsup::SetWindowText($item,$other);
exit 1;
}
elsif ($action eq 'prop') {
my %windowprop;
my
@proptoget=['text','enabled','extstyle','focused','foreground','iconic','nex
t','parent','prev','style','top','visible'];
Win32::Setupsup::GetWindowProperties($item, @proptoget,
\%windowprop);
while (my ($key,$value) = each(%windowprop)) {
print "$key = $value\n";
}
}
}
}
-----Original Message-----
From: Pierre Smolarek [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 9:42 AM
To: Elliott, Don (Police)
Subject: Re: Tk system modal window
You wanna send this script to me?
There is an app called pushpin that you can tell to make a window "top". but
within the script, no clue. sorry
----- Original Message -----
From: "Elliott, Don (Police)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 26, 2001 4:37 PM
Subject: Tk system modal window
> Hi all,
>
> I have a perl Tk program that displays a prompt line in a window.
> Does anyone know how to make this line always float to the top.
> i.e. no other window should be allowed to be displayed over top of it.
> I am running on windows 2000 with activestate perl build 623
>
> I think this mode is called system modal, but that is just a guess.
>
> Don Elliott
> Manager, Systems Management,
> Saskatoon Police Service
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]