Jump to content
Sign in to follow this  

Include .png images from resource

Recommended Posts


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!

#AutoIt3Wrapper_Res_File_Add=pic.png, rt_rcdata, pic_PNG
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Resources.au3>
$from_source = 1;
$GUI = GUICreate("show png", 400, 300)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI)
If $from_source = 1 Then
 $hImage = _ResourceGetAsBitmap("pic_PNG", $RT_RCDATA)
 $hImage = _GDIPlus_ImageLoadFromFile("pic.png")
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 50, 50, 300, 200)
Edited by kvex

Share this post

Link to post
Share on other sites

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 by trancexx




Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.