i was inspired by an article "Sample Application to load Adobe Acrobat ActiveX control' by rpnoble in this forum to try using the webBrowser to display images especially the animated Gifs, since webbrowsers are efficient in this matter.
the purpose of the following program is to display images using the webBrowser , it will add the names of images files in the current directory to a ListBox, the usage is as follows:
1- click on the button "initiate" to execute the lines:
 $OLEControl = $Control->GetOLE();
2- click on any item in the ListBox to display the image.
every time you need to click an item you must first click on the Initiate button.
why is this long route?? , because it is not working when i put those two lines inside the ListBox_Click sub, it is working only in the first click, not the second nor the third, also i have tried to simulate the physical click by calling the Button1_Click from inside the ListBox_Click without a success.
what should i do to be able to omit the button.

use strict;
use warnings;
use Cwd;
use Win32::OLE;
use Win32::GUI::AxWindow;
my $dir = getcwd;
our $OLEControl;
# 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";

my $PicList = $Window->AddListbox(
 -name   => "PicList",
 -top    => 0,
 -left   => 0,
 -width  => 125,
 -height => 110,
 -addstyle  => WS_VISIBLE | 3 | WS_VSCROLL,

#the button are for test only
-name => "initiate",
-align => "left",
-text => "Initiate",
-left => 0,
-top => 200,
-width => 100,
-height => 50,

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)
#the following button just for test only
sub initiate_Click
{ $OLEControl = $Control->GetOLE();
 $OLEControl->Navigate("about:Blank");  # Clear control

#Show application window
#Enter event loop

#Hide windows on exit
undef $Window;

sub PicList_Click {
    my $ListSelection = $PicList->SelectedItem();
    my $selectedPic = $PicList->GetString($ListSelection);
    my $picture = $dir . '/' . $selectedPic;
   #here is the supposed normal position of the initiation two line below
   # Get Ole object
   #$OLEControl = $Control->GetOLE();
   #$OLEControl->Navigate("about:Blank");  # Clear control

my $pic = "<html><body><img src='$picture' /></body></html>";
$OLEControl->{Document}->write($pic); # Write Html
return 0;


# Main window event handler

sub Window_Terminate {

  # Release all before destroy window
  undef $OLEControl;

  return -1;
sub Window_Resize {

  if (defined $Window) {
    my($width, $height) = ($Window->GetClientRect)[2..3];
    $Control->Resize ($width, $height);