Hello John,

Friday, March 04, 2005, 10:01:03 AM, You wrote:

JS> It doesn't cause any problem....
JS> But you 'may' want to wait till your threads are done....
JS> You can either detach or join to do so.

JS> Cheers,
JS> John

In fact I 'want' to wait for second thread are done. But it is GUI app
and each thread have window. Each window, therefore, has separate
message queue. And when I close main window I want the other window
get WM_CLOSE message and because of that execute callback doing some
work before closing (show messagebox or something like this). Is it
possible to do this without Win32API with ithreads only? The code
below is for Win32Gui, but, as far as I understand, it is question of
threads, not interface type.

use strict;

use threads;
use threads::shared;
use Win32::GUI;
my $thread;
my $auxW;

my $app = new Win32::GUI::Window(-name => "main", -text => "Files",
                                 -width => 170, -height => 300,
                                 -onTerminate => \&Terminate_All);
$app->AddListbox(-name => "filelist", -width => 150, -height => 300,
                 -vscroll => 1, -onDblClick => \&newthread);
my $path = Win32::GUI::BrowseForFolder(-title => "Choose a folder", -folderonly 
=> 1,
                -owner => $app, -root => "c:\\")."\\";
if ($path) {
    $app->filelist->Add(DirList($path));
    }

$app->Show();
Win32::GUI::Dialog();


sub newthread {
        return 0 if threads->list;
        $thread = threads->create("Workhorse", "$path"."$addpath");
        return 1;
    }
}

sub Terminate_Me {
    return -1;
}

sub Workhorse {
    my $namebase = shift;
    my $grid;
    $auxW = new Win32::GUI::Window(-name => "StrW", -text => $namebase,
                                      -pos => [200, 200],
                                      -size => [300, 500],
                                      -autovscroll => 1,
                                      -onTerminate => \&Terminate_Me);
    $auxW->Show;
    Win32::GUI::Dialog;
    return 1;
}

-- 
Thanks,
 Sergey                            mailto:[EMAIL PROTECTED]


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to