kvex Posted April 6, 2013 Share Posted April 6, 2013 (edited) 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 CrashCan anybody tell what I'm doing wrong?Thanks in advance!#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() Edited April 6, 2013 by kvex Link to comment Share on other sites More sharing options...
trancexx Posted April 6, 2013 Share Posted April 6, 2013 (edited) Don't use that idiotic udf Resources.au3. Try some other udfs, there are few posted in examples. My favorit is called GIFAnimation.au3 (don't let the name fool you) written by super cool girl who actually knows AutoIt, go figure. Edited April 6, 2013 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now