Jump to content

Recommended Posts

  • Developers
Posted

I have in the mean time uploaded v 12.0.1.4 (source contains correct same version) so you can have a play with it.

#AutoIt3Wrapper_Res_Icon_Add=                   ; Filename[,GroupNumber [,Language]]] of ICO to be added. 
#AutoIt3Wrapper_Res_File_Add=                   ; Filename[,Section [,ResName[,Language]]] to be added.

I do still have a error to sort out when adding this line:

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype-blank.ico

This gives an error when opening the IconGroup with ResourceHacker:

---------------------------
Resource Hacker
---------------------------
Out of system resources.
---------------------------
OK   
---------------------------

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Replies 244
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Developers
Posted

I don't know why use of "long", $RT_RCDATA in FindResource doesn't work with resources from your latest AutoIt3Wrapper while it works fine with resources from reshacker.exe -add ...

Will have a look to see what I can figure out.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted (edited)

Will have a look to see what I can figure out.

Try using:

#AutoIt3Wrapper_Res_File_Add=test_1.txt, RT_RCDATA, TEST_TXT_1 ; Filename,Section,ResName

The table witrh standard names we currently use is initialize as:

Local $aRESOURCE_TYPES[24] = ["RT_CURSOR", "RT_BITMAP", "RT_ICON", "RT_MENU", "RT_DIALOG", "RT_STRING", "RT_FONTDIR", "RT_FONT", "RT_ACCELERATOR", _
            "RT_RCDATA", "RT_MESSAGETABLE", "RT_GROUPCURSOR", "", "RT_GROUPICON", "", "RT_VERSION", "RT_DLGINCLUDE", "", "RT_PLUGPLAY", _
            "RT_VXD", "RT_ANICURSOR", "RT_ANIICON", "RT_HTML", "RT_MANIFEST"]

We could decide to use the ResHacker standards here ... opinions?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

I have in the mean time uploaded v 12.0.1.4  (source contains correct same version) so you can have a play with it.

#AutoIt3Wrapper_Res_Icon_Add=                   ; Filename[,GroupNumber [,Language]]] of ICO to be added. 
#AutoIt3Wrapper_Res_File_Add=                   ; Filename[,Section [,ResName[,Language]]] to be added.

Thanks Jos!

I do still have a error to sort out when adding this line:

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype-blank.ico

This gives an error when opening the IconGroup with ResourceHacker:

---------------------------
Resource Hacker
---------------------------
Out of system resources.
---------------------------
OK   
---------------------------

Jos

I have no problems with your example. It works fine and I can open it in reshacker without any errors.

I use reshacker.exe version 3.4.0.79 on WIN XP SP2.

Edited by Zedna
  • Developers
Posted (edited)

I have no problems with your example. It works fine and I can open it in reshacker without any errors.

I use reshacker.exe version 3.4.0.79 on WIN XP SP2.

I use the same ResHacker version (Yes George... I still need to download the latest ;) )

When I compile the script I do get the error, but the script works correctly.

PS: Did you see my post above your last post?

Edit: Last ResHacker version gives the same error.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

I use the same ResHacker version (Yes George... I still need to download the latest ;) )

Edit: Last ResHacker version gives the same error.

Jos

That was never fixed in the Beta and it won't be. I wrote a script that allows me to switch between the 2 versions but in most instances I suggest people stay with the stable (?) release. Angus has no intention of making any further changes to ResHacker unless it's something that affects him personally including old bugs.

EDIT: And he's very adamant that he won't release or even sell his code.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted (edited)

Try using:

#AutoIt3Wrapper_Res_File_Add=test_1.txt, RT_RCDATA, TEST_TXT_1 ; Filename,Section,ResName

YES. It works!

Great!!

I tried to use str instead of long in this case and it doesn't work neither with "RCDATA" nor with "RT_RCDATA".

But this isn't problem because I think long type for "resource types" is important.

#AutoIt3Wrapper_Res_File_Add=test_1.txt, RT_RCDATA, TEST_TXT_1, 0 ; Filename,Section,ResName,Language

...
$InfoBlock = DllCall("kernel32.dll", "int", "FindResourceA", "int", $hInstance, "str", "TEST_TXT_1", "long", $RT_RCDATA) ; works
$InfoBlock = DllCall("kernel32.dll", "int", "FindResourceExA", "int", $hInstance, "long", $RT_RCDATA, "str", "TEST_TXT_1", "short", 2057) ; works

$InfoBlock = DllCall("kernel32.dll", "int", "FindResourceA", "int", $hInstance, "str", "TEST_TXT_1", "str", "RCDATA") ; doesn't work
$InfoBlock = DllCall("kernel32.dll", "int", "FindResourceA", "int", $hInstance, "str", "TEST_TXT_1", "str", "RT_RCDATA") ; doesn't work

The table witrh standard names we currently use is initialize as:

...

We could decide to use the ResHacker standards here ...  opinions?

Jos

I don't know exactly what are these standards: rcdata in reshacker -add is different from RT_RCDATA?

Your table with RT_ constants is the same as constants in my Resource UDF so I have no problems with these constants.

Edited by Zedna
  • Moderators
Posted

Jos & Zedna,

I have been following this with interest. I can get everything but $RT_BITMAP resources to work with AutoItWrapper. The following is my test script - it uses the current (2.0.1.4) AutoitWrapper version:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=AutoIt v3 Compiled Script
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#AutoIt3Wrapper_Run_After=M:\Program\ResHacker\ResHacker.exe -add %out%, %out%, image2.bmp, bitmap, TEST_BMP_2, 0
#AutoIt3Wrapper_Run_After=upx.exe --best --compress-resources=0 "%out%"
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=test_1.txt, RT_RCDATA, TEST_TXT_1, 0
#AutoIt3Wrapper_Res_File_Add=image1.bmp, RT_BITMAP, TEST_BMP_1, 0
#AutoIt3Wrapper_Res_File_Add=image3.jpg, RT_RCDATA, TEST_JPG_3, 0
#AutoIt3Wrapper_Res_File_Add=binary1.dat, RT_RCDATA, TEST_BIN_1, 0
#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav, sound, TEST_WAV_1, 0

#include <GUIConstantsEx.au3>
#include <Resources_Beta.au3>

$hGUI = GUICreate("Test", 500, 750)

$hLabel = GUICtrlCreateLabel("", 10, 10, 480, 100)

$hPic1 = GUICtrlCreatePic("", 10, 120, 480, 300)

$hPic2 = GUICtrlCreatePic("", 10, 430, 480, 300)

GUISetState()

$string = _ResourceGetAsString("TEST_TXT_1", $RT_RCDATA) ; This line does work
GUICtrlSetData($hLabel, $string)

_ResourceSetImageToCtrl($hPic1, "TEST_BMP_1", $RT_BITMAP) ; This line does not work - it uses the AIWrapper loaded bitmap
;_ResourceSetImageToCtrl($hPic1, "TEST_JPG_3") ; When uncommented this line does work, so $hPic1 is a valid control
_ResourceSetImageToCtrl($hPic2, "TEST_BMP_2", $RT_BITMAP) ; This line does work - it uses the ResHacker loaded bitmap


While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

I can see no difference in ResHacker between the bitmap resources loaded by AIWrapper and ResHacker - both in the same section, both names in the same case, both languages the same - only differnce is the content. ;)

Happy to try anything else to help solve this.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Developers
Posted (edited)

YES. It works!

Great!!

I tried to use str instead of long in this case and it doesn't work either with "RCDATA" nor with "RT_RCDATA".

But this isn't problem because I think long type for "resource types" is important.

Its simple, The UDF's translates the standard ResourceTypes as defined in the posted table to the know Type number and then creates the Resource update. When it didn't find the specified string, it will created a New Resource type.

This is how I tested it:

#AutoIt3Wrapper_Res_File_Add=test_1.txt, rcdata, TEST_TXT_1 ; Filename,Section,ResName
#AutoIt3Wrapper_Res_File_Add=test_1.txt, RT_RCDATA, TEST_TXT_2 ; Filename,Section,ResName
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, test_1.txt, rcdata, TEST_TXT_3, 0

You will find 2 RCDATA section of which one is the standard RCData (10) section containing line 2 and 3 items and the other just a name called "RCDATA" containing item 1.

I don't know exactly what are these standards: rcdata in reshacker -add is different from RT_RCDATA?

Your table with RT_ constants is the same as constants in my Resource UDF so I have no problems with these constants.

This is a quote from the Helpfile so it looks like it are the name you also see in the Maoin reshacker gui:

The ResourceMask enables a command to be performed on either single or multiple resource items and takes the form ResType,ResName,ResLang. If ResType is a predefined type, then either its number or identifier can be used - eg the ResourceMask dialog,128,0 is identical to 5,128,0. Any or all of the ResourceMask items can be omitted - eg dialog,, indicates that all dialogs are to be applied to the command irrespective of name or language, and ,,1049 indicates that all resources with Russian (1049) as the languageID will be applied to the command. An empty ResourceMask ,, indicates that the command will be applied to every resource irrespective of type, name or language.

When adding or modifying items, the ResourceFile can be a RES file for any item type, a BMP file for BITMAP types, a CUR file for CURSORGROUP types, an ICO file for ICONGROUP types, and any file type for RCDATA and user defined resource types.

When adding and modifying resources from files other than RES files then both ResType and ResName must be specified in the ResourceMask. (If ResLang is omitted then the command applies to the first language item with matching type and name, otherwise, if no matching item exists then language neutral (0) is assumed.)

When extracting resources, and more than one item is implied by the ResourceMask, then the specified ResourceFile must be either a RES file or an RC file. When binary image resources are extracted to RC files, each image is also created as a separate binary (ico, cur, bmp, gif, bin) file. See example below.

ICON and CURSOR resources cannot be manipulated directly but are added, deleted, modified, and extracted by using their respective ICONGROUP or CURSORGROUP. ICON and CURSOR can still be used but Resource Hacker™ will assume ICONGROUP or CURSORGROUP was intended.

I think I do like the way it is now that clearly indicates the use of a standard name but em open to other opinions.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I use the same ResHacker version (Yes George... I still need to download the latest ;) )

When I compile the script I do get the error, but the script works correctly.

PS: Did you see my post above your last post?

Edit: Last ResHacker version gives the same error.

Jos

I tested your example from post #56

http://www.autoitscript.com/forum/index.php?showtopic=104838&view=findpost&p=758202

I don't understand how you could get error at compile time. You dont use reshacker.exe in any of (Autoit3Wrapper) directives.

I double checked it now and it really works for me without errors (Scite compile and reshacker open).

  • Developers
Posted

Jos & Zedna,

I have been following this with interest. I can get everything but $RT_BITMAP resources to work with AutoItWrapper. The following is my test script - it uses the current (2.0.1.4) AutoitWrapper version:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=AutoIt v3 Compiled Script
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#AutoIt3Wrapper_Run_After=M:\Program\ResHacker\ResHacker.exe -add %out%, %out%, image2.bmp, bitmap, TEST_BMP_2, 0
#AutoIt3Wrapper_Run_After=upx.exe --best --compress-resources=0 "%out%"
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=test_1.txt, RT_RCDATA, TEST_TXT_1, 0
#AutoIt3Wrapper_Res_File_Add=image1.bmp, RT_BITMAP, TEST_BMP_1, 0
#AutoIt3Wrapper_Res_File_Add=image3.jpg, RT_RCDATA, TEST_JPG_3, 0
#AutoIt3Wrapper_Res_File_Add=binary1.dat, RT_RCDATA, TEST_BIN_1, 0
#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav, sound, TEST_WAV_1, 0

#include <GUIConstantsEx.au3>
#include <Resources_Beta.au3>

$hGUI = GUICreate("Test", 500, 750)

$hLabel = GUICtrlCreateLabel("", 10, 10, 480, 100)

$hPic1 = GUICtrlCreatePic("", 10, 120, 480, 300)

$hPic2 = GUICtrlCreatePic("", 10, 430, 480, 300)

GUISetState()

$string = _ResourceGetAsString("TEST_TXT_1", $RT_RCDATA) ; This line does work
GUICtrlSetData($hLabel, $string)

_ResourceSetImageToCtrl($hPic1, "TEST_BMP_1", $RT_BITMAP) ; This line does not work - it uses the AIWrapper loaded bitmap
;_ResourceSetImageToCtrl($hPic1, "TEST_JPG_3") ; When uncommented this line does work, so $hPic1 is a valid control
_ResourceSetImageToCtrl($hPic2, "TEST_BMP_2", $RT_BITMAP) ; This line does work - it uses the ResHacker loaded bitmap


While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

I can see no difference in ResHacker between the bitmap resources loaded by AIWrapper and ResHacker - both in the same section, both names in the same case, both languages the same - only differnce is the content. ;)

Happy to try anything else to help solve this.

M23

Tested with this script and both added images look correct:

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Greenstone.bmp, rt_bitmap, Stone_BMP, 0
#AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, C:\WINDOWS\Greenstone.bmp, bitmap, Stone_BMP2, 0

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted (edited)

I tested your example from post #56

http://www.autoitscript.com/forum/index.php?showtopic=104838&view=findpost&p=758202

I don't understand how you could get error at compile time. You dont use reshacker.exe in any of (Autoit3Wrapper) directives.

I double checked it now and it really works for me without errors (Scite compile and reshacker open).

;) Sorry for not being clear. I get the error after the script exe is created and I open it with ResHacker to display the added Icon.

Did you try that ?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Jos & Zedna,

I have been following this with interest.  I can get everything but $RT_BITMAP resources to work with AutoItWrapper.  

I can see no difference in ResHacker between the bitmap resources loaded by AIWrapper and ResHacker - both in the same section, both names in the same case, both languages the same - only differnce is the content. ;)

Happy to try anything else to help solve this.

M23

I can confirm this problem. I didn't test whole my Resource UDF functions because I had problems with FindResource API.

For $RT_BITMAP I use LoadImage API instead of FindResource API and it seems to have some problem.

Here is piece of affected code from my UDF

If $ResType = $RT_BITMAP Then
     $hBitmap = _WinAPI_LoadImage($hInstance, $ResName, $IMAGE_BITMAP, 0, 0, 0)
     If @error Then Return SetError(2, 0, 0)
     Return $hBitmap ; returns handle to Bitmap
 EndIf
Edited by Zedna
Posted

Wow, I go to sleep and I miss all the fun ;)

Back to my original suggestions, change A1) was so the ProductVersion directive was kept inside the normal directive block. But that's just cosmetic, so doesn't need to be changed.

In the resource directive, you can use either the resource type number or the proper resource name, so 10 and RT_RCDATA are the same. I would suggest sticking with the proper directive names or ordinals. The ResHacker stuff was only used by people for Zedna's UDF. Everyone else has no idea about that process, so no need to confuse anyone with ResHacker specific terminology.

I would be careful with resource names with multiple underscores. I thought I remembered having a problem with those when using the old ResHacker method... but I can't be sure without further testing. If you have problems, try dropping all underscores from the name and see if you still have the problem.

  • Developers
Posted

Yes. I can open your compiled example in reshacker and I can see all icons and also icon groups without any errors.

When i have jus this line in a script:

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype-blank.ico

Compile it and then open it with Reshacker it get:

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Wow, I go to sleep and I miss all the fun ;)

Welcome back our resource friend :-)

In the resource directive, you can use either the resource type number or the proper resource name, so 10 and RT_RCDATA are the same.  I would suggest sticking with the proper directive names or ordinals.  The ResHacker stuff was only used by people for Zedna's UDF.  Everyone else has no idea about that process, so no need to confuse anyone with ResHacker specific terminology.

Yes now it make more sense to me and I agree to stay with these MSDN constants/names instead of reshacker.exe proprietary ones.

I would be careful with resource names with multiple underscores.  I thought I remembered having a problem with those when using the old ResHacker method... but I can't be sure without further testing.  If you have problems, try dropping all underscores from the name and see if you still have the problem.

Tested without underscores in bitmap names with the same (bad) result :-(

I know there are problems with some resource names. As far as I know you can't use numbers at begin of names, of course spaces are probably disallowed too but I didn't hear about underscore limitations.

  • Developers
Posted

Wow, I go to sleep and I miss all the fun :evil:

Sign of getting older or not a true programmer when you need sleep. ;) (for me both are valid)

Back to my original suggestions, change A1) was so the ProductVersion directive was kept inside the normal directive block. But that's just cosmetic, so doesn't need to be changed.

Not sure I understand this one. Thought the ProductVersion is be default part of the base Struct?

In the resource directive, you can use either the resource type number or the proper resource name, so 10 and RT_RCDATA are the same. I would suggest sticking with the proper directive names or ordinals. The ResHacker stuff was only used by people for Zedna's UDF. Everyone else has no idea about that process, so no need to confuse anyone with ResHacker specific terminology.

Agree.

Jos :evil:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I see the error Jos has as well. The problem is with the 256x256 icon in the filetype-blank.ico file. It is not being added correctly, I confirmed this with IcoFx on the compiled EXE. It is added to the group header and individual icons, but the data is missing / corrupt. Jos designed the icon addition code... maybe he has an idea what to fix?

I can take a look in a few hours, but I'm on my way to see Avatar again in a few minutes ;)

Regarding the RT_BITMAP stuff, I'll see if I can take a look later as well.

Posted (edited)

When i have jus this line in a script:

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype-blank.ico

Compile it and then open it with Reshacker it get:

Jos

I can see the difference! If you look at screenshot from my previous post you can see there are only 3 icons in this icon group.

It's because I use AutoIt release version 3.2.12.1 (I still need Win9x compatibility). I have installed latest beta 3.3.1.7 in Beta directory only.

If I change path to icon from my Beta directory then I can see the same error message as you.   ;)

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Beta\Icons\filetype-blank.ico

There are more than 3 icons in this icon group (bigger sizes/color depths) in latest AutoIt beta/release.

Edited by Zedna
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...