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;
}