Scott Campbell wrote (on the Perl-Win32 list):
>Now this is running as a process.  Does anyone know of a way for me to 
>send text to this window, from another perl process?

Heh! I tried this out and it actually works! :)  Cool!

Consider these files:

#!/usr/local/bin/perl -w
#File: test14.pl
use strict;
use Win32::GUI;

my $winMain = new Win32::GUI::Window(
         -left   => 13,
         -top    => 32,
         -width  => 439,
         -height => 260,
         -name   => "winMain",
         -text   => "Autoscroller",
         );

$winMain->AddLabel(
                 -text    => "lblTest",
                 -name    => "lblTest",
                 -left    => 0,
                 -top     => 0,
                 -width   => 400,
                 -height  => 250,
             );

$winMain->lblTest()->Text("The hwind is: " . $winMain->lblTest()->{-handle});
$winMain->Show();
Win32::GUI::Dialog();
#EOF


And in another file:

#!/usr/local/bin/perl -w
#File: test14a.pl
use strict;
use Win32::GUI;

print "Enter the hwind for the label: ";
my $hwind = <STDIN>;

print "\nEnter text: ";
my $text = <STDIN>;

Win32::GUI::Text($hwind, $text);
Win32::GUI::InvalidateRect($hwind, 1);
#EOF


Run them in two console windows. Look at the hwind in the Window, enter it 
into the second program. The text will update the Label in the Window.

(Of course, the window script will have to create a myprogram.hwind file 
with the correct window handler instead of having the user type it.)


This was actually a very cool way of talking to a Win32::GUI program. I can 
imagine a messaging system using this to communicate between a GUI frontend 
and one or many background processes to do the actual work. If you want to 
avoid sockets for some reason :)


/J

-------- ------ ---- --- -- --  --  -    -     -      -         -
Johan Lindström    Sourcerer @ Boss Casinos     [EMAIL PROTECTED]

Latest bookmark: "SuSE Email Server - FAQs"
<http://www.suse.de/en/products/suse_business/email_server/faqs.html>


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to