Jump to content

Resources UDF


Zedna
 Share

Recommended Posts

@Zedna

Thanks for the quick reply! I made the change and added the new Constants.au3 include as needed for the new _WinAPI_LoadLibraryEx change, however, it still crashes just before the _MemMoveMemory under Func _ResourceGetAsImage. I can see this by opening up resources.au3 and changing...

{...}
Func _ResourceGetAsImage($ResName, $ResType = 10, $DLL = -1); $RT_RCDATA = 10
    {...}some other stuff{...}
    _MemMoveMemory($ResData,$pData,$nSize)
    {...}

...to...

{...}
Func _ResourceGetAsImage($ResName, $ResType = 10, $DLL = -1); $RT_RCDATA = 10
    {...}some other stuff{...}
    MsgBox (16, "Tool", "01")
    _MemMoveMemory($ResData,$pData,$nSize)
    MsgBox (16, "Tool", "01")
    {...}

Result - the first MsgBox displays, but the AutoIt3.exe interpreter crashes straight after clicking OK, and the second MsgBox never shows.

@Melba23, thanks for going the effort to give your example :lmao: I tried your first example there which you say works for you, however I get the same crash in ntdll.dll, with the exact same exception code and offset. Does this really work for you? Don't tell me this is a Vista issue and has nothing to do with AutoIt3 or this great UDF :)

I'm going to install XP right now in VMWare and see how it works on a fresh system.

P.S. I just changed my displayname, sorry to confuse :think:

Edited by BBoySoniK
Link to comment
Share on other sites

  • Moderators

BBoySoniK & Zedna,

My first example of successfully displaying a .png does NOT work with BBoySoniK's .dll. I confirm that it does work with my .dll. I can see no substantial difference in the .dlls when I look at them in Reshacker. Both seem to have .pngs in the correct place - and before you ask, I did change the resource name (admittedly the second time I tried to run it ;-))

I am running Vista Home Premium SP1, using AutoIt 3.3.0.0 and the latest full SciTE4AutoIt editor package - so I do not think that OS is a problem here.

Over to Zedna... Have fun!

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

 

Link to comment
Share on other sites

@Melba23, thanks for going the effort to give your example :lmao: I tried your first example there which you say works for you, however I get the same crash in ntdll.dll, with the exact same exception code and offset. Does this really work for you? Don't tell me this is a Vista issue and has nothing to do with AutoIt3 or this great UDF :)

I'm going to install XP right now in VMWare and see how it works on a fresh system.

First example from Melba crashes on my Windows XP too.

Note: I'm still using AutoIt 3.2.12.1

Edited by Zedna
Link to comment
Share on other sites

  • Moderators

Zedna,

Does it crash with my .dll or BBoySonik's, or both?

M23

P.S. I somehow missed out an #include <WindowsConstants.au3> in that example - it is still in my .au3 file! I have edited the post to prevent future confusion.

Edited by Melba23

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

 

Link to comment
Share on other sites

I tried your updated example #1 M23 on a fresh install of XP Pro SP2 under VMWare, not even activated yet, and I get the exact same crash. I am using your DLL, and specifically point to it with "C:\DL\Melba.dll" which is where the example script and zedna's udf are too.

Wierd.

Just to recap, this is what I did:

- Installed WinXP Pro SP2 (unmoddified retail release)

- Installed latest AutoIt (v3.3.0.0)

- Installed latest SciTE 4 AutoIt3 (dated 2008-12-20)

- Opened C:\DL\M23test.au3 in SciTE

- Tried running with F7 - crash

- Tried compiling with F5 and running M23test.exe - crash.

Why is it working for you and not us? :S

Edited by BBoySoniK
Link to comment
Share on other sites

  • Moderators

Because I have eaten all my greens? Because I once helped an old lady over the road? Because I am a steely-eyed fighter pilot?

I have no idea - I have rebooted my machine and I still get a png from my .dll both in SciTE and compiled.

Upload your .png file - I will put it into a .dll using tlem's application and see if I can get it to display on my machine in any of my example scripts.

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

 

Link to comment
Share on other sites

LOL. Erm... download the testertool.zip a few posts back, there's an ss.png in one of the three folders. I don't think it really matters though, because your exact DLL (i'm not trying to use mine, I truly mean it!) still crashes on my PC anyway.

Zedna is on the case I hope. This is the only thing stopping me from putting my 20MB+ worth of graphic data into a data file, away from prying eyes and towards a manageable, modular program with an AutoIt3-driven GUI :lmao:

EDIT: Until something happens, or until I find something more exciting to do, i'm gonna sit around and see what happens for the next few hours. :)

Edited by BBoySoniK
Link to comment
Share on other sites

  • Moderators

BBoySoniK,

Put your .png into a .dll and it displays perfectly - both in SciTe and compiled - using the GDI example.

I am now even more confused than I was a few minutes ago - if that is possible...

M23

Edited by Melba23

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

 

Link to comment
Share on other sites

BBoySoniK,

Yup?

Put your .png into a .dll and it displays perfectly - both in SciTe and compiled - using the GDI example.

OK, I guess i'll try it again.

*Tries it*

Oh look, it crashes.

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: AutoIt3.exe
  Application Version:  3.3.0.0
  Application Timestamp:    4951fa16
  Fault Module Name:    ntdll.dll
  Fault Module Version: 6.0.6001.18000
  Fault Module Timestamp:   4791a7a6
  Exception Code:   c0000005
  Exception Offset: 00049a6b
  OS Version:   6.0.6001.2.1.0.272.7
  Locale ID:    3081
  Additional Information 1: e164
  Additional Information 2: 41f7d1a30901cfccf3c04dfedd3ad4f9
  Additional Information 3: 6fa4
  Additional Information 4: badb0b803a5da9f891754e571136834e

I am now even more confused than I was a few minutes ago - if that is possible...

You shouldn't be. It works for you, my example script and your example script you posted both do, but for some reason it doesn't for me or Zedna. With either DLL, with either script. Zedna nailed it a few posts back to a crash on a memory read, and I found that the AutoIt3 interpreter was specifically killing itself right at the _MemMoveMemory line for the _ResourceGetAsImage function.

I have no idea how to fix it, but it's definately where the problem lies - well my one anyway, don't know if Zedna's is specifically the same. There's no other way to do what i want to do, short of compiling the PNG in the compiled EXE itself, which means i'd either have to compile everytime i want to test, or write a crap load of "If IsCompiled" junk. And as I said, there are 20MB+ worth of graphic resources, and it takes about 15-20 seconds to compile (I tested it) - not exactly efficient. Im looking forward to putting all these graphics into a single DLL so I can move on, and if it's going to take time for Zedna to try and figure it out then all I can do is be patient. And pray!

I hope that didn't sound rude Melba23, I didn't forget that you did solve my first problem here :) just please believe me when I say i'm not making a newbie mistake - there is a problem that I don't know how to fix and that's all.

P.S. Zedna, if you do sort this out, i'd like to volunteer to clean-document all the features of your resource UDF and make it into a final pack, with working examples and all that (including royalty free DLL's for all users).

Anywho, guess i'll seeya guys later. Looking forward to news =)

Edited by BBoySoniK
Link to comment
Share on other sites

  • Moderators

BBoySoniK,

If it is taking so long to compile, try putting the graphics into a .res file using ResHacker. I was talking about this with Jos the other day here and it has dramatically reduced the compile time for the script.

PM me if you would like more info on how to go about it.

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

 

Link to comment
Share on other sites

BBoySoniK,

If it is taking so long to compile, try putting the graphics into a .res file using ResHacker. I was talking about this with Jos the other day here and it has dramatically reduced the compile time for the script.

PM me if you would like more info on how to go about it.

M23

That would work, as a temporary solution. I appreciate the effort to help friend, but i'm better off waiting - i'm not one for going through and changing an entire program to completely re-write the way data is handled. It's a pretty big project, and I want to get a fair solid codebase on first prototype release.

FYI, it is a various-function software with features such as acting as an external Shell Replacement for Media Centers, a Batch File Interpreter that doesn't rely on the NTVDM and using 100% GUI based output (no console), and various other tools via it's own scriptable language which would allow plugins and such. It will also eventually have a "Pro" version that will require purchase, but thats planned for sometime after release when more fancy stuff comes in.

The AutoIt side of it provides the event-driven GUI for a range of tools I write in many languages, such as C++ and even Batch files/commandline tools either 3rd party or built into windows. One thing I love about AutoIt is it's level of simplicity yet being so powerful, it can provide error checking for other components regardless of language, and interface with them in other ways with virtually unlimited potential. This is a must; as one feature it will also have is a "Friendly Event Log" - because, well, half the Event Log warnings and Errors are either completely safe to ignore and shouldn't even be listed as an alert, and/or beyond the knowledge of the average user to diagnose and repair/maintain their PC.

The main reason why I want a DLL file so badly is because it will allow a theme/skinning system, and these are easily changed by simply replacing the "theme.dll" file with an alternative. Not to mention that these DLL's will have their own executable code to cross-check all the other EXE's/Services/DLL's for tampering in an attempt to prevent reverse engineering, hacking, and eventually piracy, as the program will be fairly hardcore and tied directly to Windows internals through various hooks (C++ and .NET).

Anywho, that was a rant and a half. Lol.

EDIT: Both you and Zedna will be credited in the program, and if or when the "Pro" version does come out, you will both be offered free premium registrations if you choose to take it. Im talking, like, a year from now though :) Sorry for going off-topic there, lets return back to the point of the thread - if you have anything to say at all just PM me (that's what it's there for aye?).

Edited by BBoySoniK
Link to comment
Share on other sites

BBoySoniK,

If it is taking so long to compile, try putting the graphics into a .res file using ResHacker. I was talking about this with Jos the other day here and it has dramatically reduced the compile time for the script.

PM me if you would like more info on how to go about it.

M23

I was just going to add advice for the same as temporary (maybe permanent) workaround :-)

Here is my old post about creating/using RES file in that case only for icons but in principle it can be general RES file with anything.

http://www.autoitscript.com/forum/index.ph...st&p=169711

Princip is in precompiling all images/icons into (compiled) RES file

and then at compile time just "add" this RES file to output EXE by

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, precompiled_stuff.res ,,,
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"
Link to comment
Share on other sites

@BBoySoniK

I will try my best to fix this problem/help you

but now I'm badly ill and

I'm not sure how to fix _MemMoveMemory() crash

so be patient ;-)

Zedna

Sorry to hear you're not well :) Take your time brother, I do have a life after all and there are other parts of the code I can work on It's a great thing you've done for us here! :) Take care!

Link to comment
Share on other sites

make following changes in _ResourceGet()

as Zedna suggested use LoadLibraryEx()

;$hInstance = _WinAPI_LoadLibrary($DLL)

$hInstance = _WinAPI_LoadLibraryEx($DLL, $LOAD_LIBRARY_AS_DATAFILE)

comment out these two lines:

;If $DLL <> -1 Then _WinAPI_FreeLibrary($hInstance)

;If @error Then Return SetError(11, 0, 0)

png splash screen loads from dll

be seeing you

I see fascists...

Link to comment
Share on other sites

make following changes in _ResourceGet()

as Zedna suggested use LoadLibraryEx()

;$hInstance = _WinAPI_LoadLibrary($DLL)

$hInstance = _WinAPI_LoadLibraryEx($DLL, $LOAD_LIBRARY_AS_DATAFILE)

comment out these two lines:

;If $DLL <> -1 Then _WinAPI_FreeLibrary($hInstance)

;If @error Then Return SetError(11, 0, 0)

png splash screen loads from dll

be seeing you

OH MY GOSH IT WORKS.

Wow. Thank you so much rover! I did the first part, modifying $hInstance, but commenting out those next two lines did it! Amazing! Wow! I'm so happy! Thank you! :)

Link to comment
Share on other sites

  • Moderators

rover,

Take a well-earned round of applause!!

When I change _ResourceGet() to use _WinAPI_LoadLibraryEx as proposed, the script using Zedna's _ResourceSetImageToCtrl works (once I include Constants.au3) - and my GDI based script using _ResourceGetAsImage continues to work as before.

So for an encore, can you explain why I did not need to change the UDF to make it work using the GDI example? _ResourceGetAsImage still uses _ResourceGet as far as I can see - so why does it work (for me, at least) in that case and not when called as part of _ResourceSetImageToCtrl?

A secondary question if I may - as a neophyte in .dll matters, is there not a problem with omitting the _WinAPI_FreeLibrary to release the .dll? Or does the $LOAD_LIBRARY_AS_DATAFILE parameter remove that requirement?

Sorry for so many questions, but I am really intrigued as to why there was this difference. Thanks in advance if you can shed any more light on this.

M23

P.S. Zedna, best wishes for a speedy recovery.

Edited by Melba23

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

 

Link to comment
Share on other sites

Hi all, sorry for asking, i did read the first 3 pages but didn't understand how to do it

Suppose i have a setup file (setup.exe) and want to make an automatic install so i made a install.exe coded in autoit.

What i want to do now is integrate the setup.exe in install.exe to use one single big file. Is it possible ? I did similar things before but with images only.

I successfully compiled the file but i don't know how to call the resource in Run("..")

Any help very much appreciated, thanks.

Link to comment
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
 Share

  • Recently Browsing   0 members

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