When I build an executable using perlapp on the following code, I get this
error message:
Can't call method "Navigate" on an undefined value at Axsample.pl line 29.
What's happening? And what can I do to make it work. Thanks.
use Win32::GUI;
use Win32::OLE;
use Win32::GUI::AxWindow;
# main Window
$Window = new Win32::GUI::Window (
-title => "Win32::GUI::AxWindow and Win32::OLE",
-pos => [100, 100],
-size => [400, 400],
-name => "Window",
) or die "new Window";
# Create AxWindow
$Control = new Win32::GUI::AxWindow (
-parent => $Window,
-name => "Control",
-pos => [0, 0],
-size => [400, 300],
-control => "Shell.Explorer.2",
) or die "new Control";
# Get Ole object
my $html = '<html><body><a
href="http://www.perl.com">perl.com</a></body></html>';
$OLEControl = $Control->GetOLE();
$OLEControl->Navigate("about:blank"); # Clear control
$OLEControl->{Document}->write($html); # Write Html
# Event loop
$Window->Show();
Win32::GUI::Dialog();
# Main window event handler
sub Window_Terminate {
# Release all before destroy window
undef $OLEControl;
$Control->Release();
return -1;
}
sub Window_Resize {
if (defined $Window) {
($width, $height) = ($Window->GetClientRect)[2..3];
$Control->Resize ($width, $height);
}
}
Regards,
Sam Dela Cruz