Jump to content

ResourcesEx UDF.


guinness
 Share

Recommended Posts

  • Moderators

drmusti,

The UDF has not been updated for some time and a recent poster found that you needed an additional include file #include <WinAPISysWin.au3>. If the "Unknown function name" was _WinAPI_SetWindowLong then that is indeed the problem.

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

  • 1 year later...
On 3/4/2018 at 8:50 PM, Jowy said:

@guinness, thanks for the great work. But when I compiled my script on the new AutoIT version, the ResourcesEx.au3 needs an include file:

#include <WinAPISysWin.au3> needed by _WinAPI_SetWindowLong

Regards,

Jowy

Thank you! My script using ResourcesEx would not compile: "_WinAPI_SetWindowLong" "undefined function"

So I edit ResourcesEx.au3 adding that include:

#include <WinAPISysWin.au3>

and now it compiles, Hooray!

Edited by xekon
Link to comment
Share on other sites

EDIT: I should have opened up the UDF, it is self documented and appears to support what I am trying to do :)

_Resource_SetToCtrlID($L, 'Torus', Default, Default, True)

When using _Resource_SetToCtrlID() is there a way to resize the image to the dimensions of the control, even if that means stretching the image?

currently when I create a control then use _Resource_SetToCtrlID(), it resizes the controls dimensions for me and uses the images physical dimensions.

For most cases thats actually perfect, but I am needed to be able to set some images to some controls and have the image stretched to fit.

I am including a test case as well as some images to further illustrate my issue and what I am trying to accomplish.

currently this is what I am seeing:

pLghR4x.png

my desired outcome is actually:

7m5Q9h5.png

and here is the code for this example:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add="C:\Program Files (x86)\AutoIt3\Examples\GUI\Torus.png", RT_RCDATA, Torus, 0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ResourcesEx.au3>;transparent gui buttons
#include <WinAPISysWin.au3>;requirement
#include <GUIConstantsEx.au3>;gui
#include <array.au3>;arrays

Local $hGUI = GUICreate("Test", 1024, 768)
$bg = GUICtrlCreatePic("C:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 1024, 768)
GUICtrlSetState($bg,$GUI_DISABLE)
GUISetState(@SW_SHOW)

Local $L = GUICtrlCreatePic('', 100, 100, 400, 50)

;debug shows that the GUICtrlCreatePic is set to my desired width 400 and height 50
MsgBox($MB_SYSTEMMODAL, "control properties", _ArrayToString(ControlGetPos("Test", "", $L ), @TAB))

_Resource_SetToCtrlID($L, 'Torus')

;debug shows that _Resource_SetToCtrlID has changed the dimensions of the control I created with GUICtrlCreatePic
MsgBox($MB_SYSTEMMODAL, "control properties", _ArrayToString(ControlGetPos("Test", "", $L ), @TAB))

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf

    sleep(random(6,9))
Wend
GUIDelete($hGUI)

I am hoping that this UDF supports such a method, but if not, let me know if anyone can think of a clever solution.

Edited by xekon
Link to comment
Share on other sites

I tried

_Resource_SetToCtrlID($L, 'Torus', True)

which according to the functions documentation in the UDF should have resized the image, but when I do this the Torus image does not load at all.

EDIT: I got it working :)

_Resource_SetToCtrlID($L, 'Torus', Default, Default, True)

 

Edited by xekon
Link to comment
Share on other sites

Hi all. Hopefully you can shed some light on my chaos.
I seem to be chasing my tail a bit here, but I'm trying to make a more visually appealing way for users to update the firmware on a device instead of having a bunch of files and running a .bat.
I can't find anyway of wrapping and running an exe (that also needs a dll) and firmware file. A small example of what I've got so far, that is pulling from the scriptdir for the time being:

#AutoIt3Wrapper_Res_File_Add=updater.exe, rt_rcdata, updater, 0
#AutoIt3Wrapper_Res_File_Add=lib.dll, rt_rcdata, lib, 0
#AutoIt3Wrapper_Res_File_Add=firmware.dfu, rt_rcdata, firmware, 0

Run(@ComSpec & " /c " & "updater.exe upgrade firmware.dfu > %temp%\output.txt", "", @SW_HIDE)

Instead is there a way of exporting the wrapped files to the temp directory for example so they can be run from there?
I haven't seen anything obvious for exporting wrapped files, but I'm probably just blind from lack of coffee.

Many thanks in advance.

Link to comment
Share on other sites

  • Developers
7 minutes ago, SimonRu said:

Instead is there a way of exporting the wrapped files to the temp directory for example so they can be run from there?

Just use the FileInstall() function for 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.
  :)

Link to comment
Share on other sites

  • 2 years later...
  • Developers
1 hour ago, miha04 said:

at least i think so :whistle:

Correct, $__XYZ from a standard UDF should never be used as that is considered an internally used variable, so can change. 
Like:https://www.autoitscript.com/trac/autoit/ticket/3860

... but the correct info is FIle: RecoursesEx.au3 and line is 788. ;) 
.. and the same needs to be done in RecoursesEx_PE.au3

Updated the initial post with a fixed zip file next to original one as @guinnessisn't around a lot these days. ;)

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.
  :)

Link to comment
Share on other sites

  • 3 weeks later...
  • 7 months later...
  • Developers

I see I have added this line after the latest upload I have done to fix that:

#include <WinAPISysWin.au3>

Will update the upload.

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.
  :)

Link to comment
Share on other sites

  • 3 months later...

Note

with last ResourcesEx  27-4-2023 updated

to get Example.au3 to work with AutoIt Version..: 3.3.16.1,  I needed to make the following change in  Func IsXP()

Func IsXP()
;~  Return $__WINVER < 0x0600
    Return _WinAPI_GetVersion() < 6
EndFunc   ;==>IsXP

 

Edited by ioa747

I know that I know nothing

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...