Ahmet has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I'm testing AxWindow module with threads.Creating new thread and posting an html code to AxWindow with OLE object.
But window returning error and after closing.Not find in the script my error.
AxWindow module or Win32::OLE is Thread-safe?
Perl : v5.12
OS : Win7
Win32::GUI : V1.6
Win32::OLE : 0.1709
Here's my test code;#!perl -w use strict; use warnings; use Win32::GUI qw(WS_CLIPCHILDREN); use Win32::OLE(); use Win32::GUI::AxWindow(); use threads; # main Window my $Window = new Win32::GUI::Window ( -title => "Win32::GUI::AxWindow", -pos => [100, 100], -size => [600, 600], -name => "Window", -addstyle => WS_CLIPCHILDREN, ) or die "new Window"; # A button my $Button = $Window->AddButton ( -name => "Button", -pos => [0, 25], -size => [600, 50], -text => "Click me !!!", ); # Create AxWindow my $Control = new Win32::GUI::AxWindow ( -parent => $Window, -name => "Control", -pos => [0, 100], -size => [600, 500], -control => "Shell.Explorer.2", ) or die "new Control"; # Get Ole object my $OLEControl = $Control->GetOLE(); $OLEControl->Navigate("about:blank"); # Clear control threads->create(\&thrTest); $Window->Show(); Win32::GUI::Dialog(); $Window->Hide(); exit(0); # Running with Button Click event sub Button_Click { my $text = "Click!!"; $OLEControl->{Document}->{body}->insertAdjacentHTML("AfterBegin",$text +); } sub thrTest { my $text = "Thread test on AxWindow"; $OLEControl->{Document}->{body}->insertAdjacentHTML("AfterBegin",$text +); }
Regards,
Ahmet
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::GUI::AxWindow error, with using a thread?!
by Ahmet (Novice) on Apr 24, 2011 at 01:19 UTC |