Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Include .png images from resource

$
0
0
Hi all,

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
Can anybody tell what I'm doing wrong?

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()

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>