[SOLVED] Not support RT_PNG ? Resources/EX UDF and AutoIt3Wrapper

6 posts in this topic

#1 ·  Posted (edited)

I can not find the ID of resources RT_PNG and can not use AutoIt3Wrapper to add resources RT_PNG
I have to use RT_BITMAP to replace RT_PNG.

Someone knows ID of RT_PNG?



Global Const $RT_CURSOR = 1
Global Const $RT_BITMAP = 2
Global Const $RT_ICON = 3
Global Const $RT_MENU = 4
Global Const $RT_DIALOG = 5
Global Const $RT_STRING = 6
Global Const $RT_FONTDIR = 7
Global Const $RT_FONT = 8
Global Const $RT_ACCELERATOR = 9
Global Const $RT_RCDATA = 10
Global Const $RT_MESSAGETABLE = 11
Global Const $RT_GROUP_CURSOR = 12
Global Const $RT_GROUP_ICON = 14
Global Const $RT_VERSION = 16
Global Const $RT_DLGINCLUDE = 17
Global Const $RT_PLUGPLAY = 19
Global Const $RT_VXD = 20
Global Const $RT_ANICURSOR = 21
Global Const $RT_ANIICON = 22
Global Const $RT_HTML = 23
Global Const $RT_MANIFEST = 24

Resources UDF

ResourcesEX UDF

Edited by VIP

“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post

Link to post
Share on other sites

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post

Link to post
Share on other sites

How I can get PNG resource?



“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post

Link to post
Share on other sites
2 minutes ago, Jos said:


and How I can get PNG resource from AutoIt?
Resources UDF  need ID of resource type, not name "PNG"!

“The world won’t care about your self-esteem. The world will expect you to accomplish something Before you feel good about yourself.”

Share this post

Link to post
Share on other sites

This script will also retrieve the resource from the compiled script and write it to another file:


#include <WinAPIRes.au3>
#include <WinAPIInternals.au3>

Local $bBytes = _GetResourceAsBytes("PNG")
If @error Then
    ; Resource not found
    FileWrite("testOut.png", $bBytes)

Func _GetResourceAsBytes($sResName, $seq=1)
    Local $hMod = _WinAPI_GetModuleHandle(Null)
    Local $hRes = _WinAPI_FindResource($hMod, $sResName, $seq)
    If @error Or Not $hRes Then Return SetError(1, 0, 0)
    Local $dSize = _WinAPI_SizeOfResource($hMod, $hRes)
    If @error Or Not $dSize Then Return SetError(2, 0, 0)
    Local $hLoad = _WinAPI_LoadResource($hMod, $hRes)
    If @error Or Not $hLoad Then Return SetError(3, 0, 0)
    Local $pData = _WinAPI_LockResource($hLoad)
    If @error Or Not $pData Then Return SetError(4, 0, 0)
    Local $tBuffer = DllStructCreate("byte[" & $dSize & "]")
    _WinAPI_MoveMemory(DllStructGetPtr($tBuffer), $pData, $dSize)
    Return DllStructGetData($tBuffer, 1)


1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

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

  • Similar Content

    • LFCavalcanti
      By LFCavalcanti
      Backstory to understand my need:
      I'm building something similar to what Chunk VNC was, using the Single Click function from UltraVNC to provide remote support.
      My "little monster" is actually working, but the "solution" will have 3 modules:
      SUPPORT: Users will open or install so IT Pros can access their system. VIEWER: IT Pros use to connect to User systems and perform their maintenance GENERATOR: The IT Pro uses to define the configuration for both the SUPPORT and VIEWER apps, like language files for text, SERVER address and ports, Company name, etc. I've attached a screenshot of the SUPPORT app that is done.
      Before anyone points the finger, no I'm not planning on just copying the AutoIt3 files to my project folder and distribute them, I intend to get the IT Pro who will use the GENERATOR to install SciTE and AutoIt3 then the GENERATOR will use them to compile the other two apps.
      The thing is, I need this to be simple, I thought about the GENERATOR having a single screen where the IT Pro can fill in all the information, select the language file and so on, then the GENERATOR compiles both "au3" sources for the SUPPORT and VIEWER.
      I'm using the ResourceEx UDF from Guiness and MetroUI UDF from BBs19. I even made some changes to the MEtroUI, that I shared here.
      This project will be uploaded to my Github account as soon I get this GENERATOR working, so people can actually use it.
      The problem:
      As explained, I need to compile the AU3 source files and perform an Resource Update. SciTE does that for me, right, but I just find sloppy making the GENERATOR open the script on the installed SciTE, clicking in the menus, waiting the process to end and then exit.
      When I hit the Compile or Build on SciTE, it generates this output:
      I've tried emulating this using the promt with console commands:
      It returns an error saying it was not possible to perform a resource update, poiting an TMP file on the ".../AppData/Local/AutoIt3/".
      As I understand, it runs the AutoIt3Wrapper, then the Wrapper should call the Aut2Exe to compile the script and then the Wrapper incorporate the resources into the compiled Script. It generates the file into a TMP one then copies to the directory defined in the Wrapper Directive.
      I know this seems strange, that you think I might be trying to pack AutoIt into my project with no F*** given, no... I just want to automate the compilation process, if there's no solution using console commands, I'll need to automate the process sending keyboard and mouse commands, what will be ugly and problematic.
      So... any help is a heaven's gift at this point.

    • taylansan
      By taylansan
      Hello dears,
      How can I hide the wrapper or check on the debug window?
      >"C:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "D:\Taylan\Projects\AU3\Browser\TimesMe\TimesMe.au3" /UserParams +>11:39:12 Starting AutoIt3Wrapper v.16.306.1237.0 SciTE v. Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86 Environment(Language:0409) CodePage:0 # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM +> SciTEDir => C:\Program Files\AutoIt3\SciTE UserDir => C:\Users\t00722811\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\t00722811\AppData\Local\AutoIt v3\SciTE >Running AU3Check ( from:C:\Program Files\AutoIt3 input:D:\Taylan\Projects\AU3\Browser\TimesMe\TimesMe.au3 +>11:39:12 AU3Check ended.rc:0 >Running:(\Program Files\AutoIt3\autoit3.exe "D:\Taylan\Projects\AU3\Browser\TimesMe\TimesMe.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop ... blablabla +>11:39:13 AutoIt3.exe ended.rc:0 +>11:39:13 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.822 I have checked the view or options menu, but couldn't find much about this.
      Is there any way to hide these outputs?

    • Jos
      By Jos
      11-3-2016: Uploaded a new SciTE4AutoIt3.exe.
      Merged the SciTE 3.6.2 source into our version and several other changes and fixes to the supporting utilities.
      Addition/Changes/Fixes in the current installer:
      -------------------------------------------------------------------------------------------------- 6-3-2016 *** Merged the SciTE v 3.6.2 by Neil Hodgson with our own version of SciTE. (Jos) *** Updated AutoIt3Wrapper v16.306.1237.0 (Jos) - 15.920.938.2 removed the check for utf8 for au3check as that is supported - 15.920.938.3 Reverted __ConsoleWrite() to ConsoleWrite for ShowStdOutErr() - 15.920.938.4 added info for codepage and utf8 check to header. - 15.920.938.5 Only warn about #RequireAdmin for Run option. - 15.920.938.6 fixed issue when these were used together: #AutoIt3Wrapper_Run_Au3Stripper=y #AutoIt3Wrapper_Res_SaveSource=Y - 15.920.938.8 Modifications from DickG for the GUI Control locations and sizes to fit other screen sizes. *** Updated Au3Stripper v16.306.1237.0 (Jos) - 15.920.938.2 Fixed error line number for statements using unresolved func name Added logic to remove the () behind the Func in case of this type of lines: Call(Example3(), 'fff') NewFoundWord$ is then="Example3()" - 15.920.938.3 Added minus sign support to preexpand variables. - 15.920.938.4 Fixed crash in the get firstword logic to limit the returned length to 500. - 15.920.938.5 Fixed /PE replacing the variable in a For $x= statement. *** Updated SciTEConfig v16.306.1237.0 (Jos) - 15.920.938.1 hide/unhide when opening Tidy.ini to avoid a hidden msgbox hanging SciTEConfig.au3 - 15.920.938.2 Added the creation of includes.txt for AutoComplete Standard UDFs when "#include" is typed. - 15.920.938.3 Fixed for CallTip not always updating correctly. *** Updated Tidy v16.306.1237.0 (Jos) - 15.920.938.1 Fixed issue with space removal between [ and Then - 15.920.938.2 #forceref and #forcedef now also tidied. - 15.920.938.3 Enfoces a single space between end-of-line and inline comment - 15.920.938.4 Fixed regression extra space between EndFunc and #EndRegion and the added comments. --------------------------------------------------------------------------------------------------   ==> ScitillaHistory page containing all SciTE-Scintilla updates.
      ==> Visit the SciTE4AutoIt3 Download page for the latest versions
      ==> Check the newly formatted the online documentation for an overview of all extra's you get with this installer.
    • Skysnake
      By Skysnake
      >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "C:\AutoIt\dev\main.au3"
      +>19:58:38 Starting AutoIt3Wrapper v. SciTE v.   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86    Environment(Language:0409)
      +>         SciTEDir => C:\Program Files\AutoIt3\SciTE   UserDir => C:\Users\Home\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Home\AppData\Local\AutoIt v3\SciTE 
      -> No changes made..
      >Running Au3Stripper (  from:C:\Program Files\AutoIt3\SciTE\Au3Stripper cmdline:
      -### StripOnly/StripFunc Error: Found Call() statement using unsolvable Func, which will/could lead to removal of Funcs that are used by this Function.
      >### current Func: _sqlite_gettable2d
      C:\Program Files\AutoIt3\include\SQLite.au3(598,1) Warning for line:$iCbRval = Call($sCallBack, $aDataRow) 
      -### StripOnly/StripFunc Error: Found Call() statement using unsolvable Func, which will/could lead to removal of Funcs that are used by this Function.
      >### current Func: _sqlite_gettable2d
      C:\Program Files\AutoIt3\include\SQLite.au3(614,1) Warning for line:$iCbRval = Call($sCallBack, $aDataRow) 
      If I run my script with F5 it works.  If I compile with Stripper, I get this.  EXE seems to work though... ?
      Compiling without stripper, no problem 
      "Error" seems to be in SQLITE.AU3 and limited to   _sqlite_gettable2d -> or rather thats all I am currently using.
      The offending lines in SQLITE.AU3 are      
              Local $iCbRval
              $iCbRval = Call($sCallBack, $aDataRow)
              If $iCbRval = $SQLITE_ABORT Or $iCbRval = $SQLITE_INTERRUPT Or @error Then
      Please advise?
    • Michiel
      By Michiel
      Which of the two should I use? It seems pragma compile offers access to resource fields that AutoIt3Wrapper only allows access to via Res_Field, such as CompanyName and ProductName. AutoIt3Wrapper offers help with versioning in the form of automatic version increase, pragma doesn't. (afaik)
      Should one ever combine the two in one script? Could I e.g. increase the ProductVersion automatically as well with AutoIt3Wrapper?
      I'm using the Beta, with Scite 3.4.4 Full as well as TortoiseSVN and WinMerge.