没有从win32 :: gui :: LoadImage返回

时间:2013-07-09 15:07:32

标签: win32gui strawberry-perl

我在Microsoft Windows 7系统上使用为MSWin32-x86-multi-thread和win32 :: GUI构建的Strawberry Perl(v5.16.3)。我正在使用Eclipse / EPIC来编写和测试代码。

我正在尝试显示图片/位图/图标/光标。已经尝试了所有3,结果同样没有从win32 :: gui :: LoadImage返回。

我已经为gui.PM添加了一些打印行以进行调试,我有一个测试脚本来测试这个gui函数。由于win32 :: gui :: LoadImage子例程的代码不在GUI.PM模块中,它是否包含在C库或Windows中?是否需要更改调用win32 :: gui :: LoadImage的代码?

提前感谢您的帮助 鲍勃

## print lines added to gui.PM for debugging ##########
## (Lines are Suffixed with comment #Bob) #############

package Win32::GUI::Bitmap;
@ISA = qw(Win32::GUI);
end;

sub new {
    my $class = shift;
    my $self = {};

my $inputa =shift @_; #Bob

print "Len=" . length($inputa)."\n"; #Bob

#   my $handle = Win32::GUI::LoadImage(@_); #Bob commented out the origional
    my $handle = Win32::GUI::LoadImage($inputa, 0, 0, 0, 0); #Bob

print "Gui.PM(Win32::GUI::_new) self='$self' input='@_' inputa='$inputa' \n ";# Bob
print "Gui.PM handle=".$handle."  ".$self."\n";  #Bob
# TODO: this gives us a bitmap object, even if we ask for a cursor!


#### test script ####################################################
    use Win32::GUI();
our $Window = Win32::GUI::Window->new(
    -name => "Window",
    -top => 120,
    -left => 120,
    -height => 300,
    -width => 300
    );

our $Icon="";
    $Icon = Win32::GUI::Bitmap->new("eclipse16.gif") ;#or die $^E; 
print "Test Icon=".$Icon."\n";  # See if Bitmap return anything

our $Button = $Window -> AddButton(
    -name => "Icon",
    -text => "Icon",
    -top => 50,
    -left => 50,
    -height => 100,
    -width => 100,
    -picture => $Icon,
    -icon => $Icon,
    -bitmap => $Icon,  # add this line here, try if works
    );

#    $Window->$Button-> $Bitmap ;

$Window->SetIcon($Icon);

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

    sub Window_Terminate {
    return -1;
    }

0 个答案:

没有答案