hello
i have a solution, using the Google.pl found in the win32 gui package
we add in the main body:
# Register Event
$Control->RegisterEvent ("DocumentComplete", "DocumentComplete_Event" );
and add the following:
# Event handler
sub DocumentComplete_Event {
$OLEControl->{Document}->write($pic); # Write Html
}
so we have a good animated Gifs viewer
the program now is:
use strict;
use warnings;
use Cwd;
use Win32::GUI qw(WS_VSCROLL WS_VISIBLE);
use Win32::OLE;
use Win32::GUI::AxWindow;
my $dir = getcwd;
our $OLEControl;
our $pic;
# main Window
my $Window = new Win32::GUI::Window (
-title => "Win32::GUI::AxWindow and Win32::OLE",
-pos => [0, 0],
-size => [620, 470],
-name => "Window",
) or die "new Window";
# Create AxWindow
our $Control = new Win32::GUI::AxWindow (
-parent => $Window,
-name => "Control",
-pos => [150, 0],
-size => [400, 400],
-control => "Shell.Explorer.2",
) or die "new Control";
# Register Event
$Control->RegisterEvent ("DocumentComplete", "DocumentComplete_Event" );
my $PicList = $Window->AddListbox(
-name => "PicList",
-top => 0,
-left => 0,
-width => 125,
-height => 110,
-addstyle => WS_VISIBLE | 3 | WS_VSCROLL,
);
opendir DH, $dir or die "Cannot open $dir: $!";
my @files = grep { ! -d } readdir DH;
closedir DH;
#choose only jpg or gif files
my @picFiles = grep /.+\.jpg|gif/,@files;
# work with @files
foreach my $item (@picFiles)
{
$PicList->Add($item);
}
#Show application window
$Window->Show();
#Enter event loop
Win32::GUI::Dialog();
#Hide windows on exit
$Window->Hide();
undef $Window;
exit(0);
# Event handler
sub DocumentComplete_Event {
$OLEControl->{Document}->write($pic); # Write Html
}
sub PicList_Click {
my $ListSelection = $PicList->SelectedItem();
my $selectedPic = $PicList->GetString($ListSelection);
my $picture = $dir . '/' . $selectedPic;
# Get Ole object
$OLEControl = $Control->GetOLE();
$OLEControl->Navigate("about:Blank"); # Clear control
$pic = "<html><body><img src='$picture' /></body></html>";
return 0;
}
# Main window event handler
sub Window_Terminate {
# Release all before destroy window
undef $OLEControl;
$Control->Release();
return -1;
}
sub Window_Resize {
if (defined $Window) {
my($width, $height) = ($Window->GetClientRect)[2..3];
$Control->Resize ($width, $height);
}
}
__END__
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/