Hi all,
I've got difficulties displaying a .png image from resources. The snippet below reproduces the error. I've tried 4 scenarios:
Thanks in advance!
I've got difficulties displaying a .png image from resources. The snippet below reproduces the error. I've tried 4 scenarios:
- $from_source = 0, run from script --> OK
- $from_source = 0, compile, run .exe --> OK
- $from_source = 1, run from script --> OK'ish (empty box but no crash)
- $from_source = 1, compile, run .exe --> Program Crash
Thanks in advance!
[ autoit ]
#AutoIt3Wrapper_Res_File_Add=pic.png, rt_rcdata, pic_PNG #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Resources.au3> $from_source = 1; _GDIPlus_Startup() $GUI = GUICreate("show png", 400, 300) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI) If $from_source = 1 Then $hImage = _ResourceGetAsBitmap("pic_PNG", $RT_RCDATA) Else $hImage = _GDIPlus_ImageLoadFromFile("pic.png") EndIf _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 50, 50, 300, 200) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete()