Jump to content

Recommended Posts

Posted (edited)

  On 2/2/2010 at 4:22 PM, 'PhilipG said:

I've never used resource files so i don't no what to look for, but when i open the file in ResHack it showed a folder tree

In that case it may be better to use FileInstall() instead of my Resource UDF.  It's very simple.

Latest Scite4Autoit3 beta has new simpler syntax for adding resources (#AutoIt3Wrapper_Res_File_Add=) and it doesn't need reshacker.exe.

After Jos push it from beta to release state I will update my UDF and description accordingly.

Edited by Zedna
Posted

Well I downloaded the beta version, and no I got the file into the resource file. But it still don't show up, but i guess it's a bit closer!

Posted

  On 2/2/2010 at 7:21 PM, 'wraithdu said:

That shouldn't be necessary.

#AutoIt3Wrapper_Res_File_Add=C:\path\to\file.ext,RT_RCDATA,MYRESOURCENAME

should work just fine.

I don't know why, but when i changed from RT_RCDATA to 10 it worked fine, but before it didn't

  • Moderators
Posted (edited)

PhilipG,

You need to use $RC_DATA, which is a Const value AutoIt understands. Of course, using the actual value of 10 also works as you found. :D

#AutoIt3Wrapper_Res_File_Add=C:\path\to\file.ext,$RT_RCDATA,MYRESOURCENAME

M23

Edit: Ignore all this - see below

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:

  Reveal hidden contents

 

  • Developers
Posted (edited)

  On 2/4/2010 at 7:09 PM, 'Melba23 said:

PhilipG,

You need to use $RC_DATA, which is a Const value AutoIt understands. Of course, using the actual value of 10 also works as you found. :D

#AutoIt3Wrapper_Res_File_Add=C:\path\to\file.ext,$RT_RCDATA,MYRESOURCENAME

M23

Don't think AutoIt3Wrapper will understand a variable. :huggles:

RT_RCDATA is a known sting.

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)

What he said :D AI3Wrapper reads the directive as a string, so it looks for "RT_RCDATA". Yes it also understands integers, which is why 10 works, but there's no reason the string value shouldn't work either. And as I've tested it myself... well, it works. Trying to use an AutoIt variable is useless since these are preprocessor directives and know nothing of the AutoIt script.

What version of AutoIt3Wrapper are you testing and where did you get it from? In some earlier builds I hadn't coded the string recognition yet, but those were private alphas.

Edited by wraithdu
Posted

  On 6/28/2009 at 1:15 PM, 'Yashied said:

Zedna, in your UDF I found a small bug related to memory leaks when using the _SetBitmapToCtrl(). After reading that, I corrected it.

Func _SetBitmapToCtrl($CtrlId, $hBitmap)

    Local Const $STM_SETIMAGE = 0x0172
    Local Const $STM_GETIMAGE = 0x0173
    Local Const $IMAGE_BITMAP = 0
    Local Const $SS_BITMAP = 0x0E
    Local Const $GWL_STYLE = -16

    Local $hWnd, $hPrev, $Style

    $hWnd = GUICtrlGetHandle($CtrlId)
    If $hWnd = 0 Then
        Return SetError(1, 0, 0)
    EndIf
    $Style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
    If @error Then
        Return SetError(2, 0, 0)
    EndIf
    _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, BitOR($Style, $SS_BITMAP))
    If @error Then
        Return SetError(3, 0, 0)
    EndIf
    $hPrev = _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, 0)
    If $hPrev Then
        _WinAPI_DeleteObject($hPrev)
    EndIf
    _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)
    If @error Then
        Return SetError(4, 0, 0)
    EndIf
    $hPrev = _SendMessage($hWnd, $STM_GETIMAGE, $IMAGE_BITMAP, 0)
    If (@error) Or ($hBitmap = $hPrev) Then
        $hBitmap = 0
    EndIf
    If $hBitmap Then
        _WinAPI_DeleteObject($hBitmap)
    EndIf

    Return 1
EndFunc   ;==>_SetBitmapToCtrl

With this version doesn't work correctly my example from first post using animated GIFs resource_test_ani_gif.au3

so I will stick with my old version:

...

    $hPrev  = _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)
    If @error Then Return SetError(3, 0, 0)
    If $hPrev Then _WinAPI_DeleteObject($hPrev)
Posted (edited)

Updated first post:

2010-02-12
- all examples now use fixed #AutoIt3Wrapper_Res_File_Add directive from latest Scite4Autoit3 (no need for ResHacker.exe)
- added support for buttons (also checkboxes,radiobuttons,groupboxes) in _ResourceSetImageToCtrl()/_SetBitmapToCtrl() thanks Melba

EDIT: Also renamed title of this topic ;-)

Edited by Zedna
Posted (edited)

Just one note to adding data to resources by AutoIt3Wrapper directive:

#AutoIt3Wrapper_Res_File_Add=FileName, ResType, ResName

According to AutoIt3Wrapper sources - as ResType can be used these (case insensitive):

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"]
Edited by Zedna
  • 1 month later...
Posted

For those who use the full version of SciTe and wish for the following commands to show in the command popup box, I have created entries for <au3.user.calltips.api> and <au3.userudfs.properties> (Located in the api and properties folders)

Add the following to <au3.user.calltips.api>

_ResourceGet($ResName [, $ResType [, $ResLang [, $DLL]]]) Get from Resource (as a pointer) (Requires: #Include <Resources.au3>)
_ResourceGetAsBitmap($ResName [, $ResType [, $DLL]]) Get from Resource as a Bitmap Image (Requires: #Include <Resources.au3>)
_ResourceGetAsBytes($ResName [, $ResType [, $ResLang [, $DLL]]]) Return bytes of Resource (Requires: #Include <Resources.au3>)
_ResourceGetAsImage($ResName [, $ResType [, $DLL]]) Get Picture from Resource as hImage type (Requires: #Include <Resources.au3>)
_ResourceGetAsString($ResName [, $ResType [, $ResLang [, $DLL]]]) Get String from Resource (Requires: #Include <Resources.au3>) 
_ResourceGetAsStringW($ResName [, $ResType [, $ResLang [, $DLL]]]) Get String from Resource (Unicode) (Requires: #Include <Resources.au3>)
_ResourcePlaySound($ResName [, $Flag [, $DLL]]) Play Sound from Resource (Requires: #Include <Resources.au3>)
_ResourceSaveToFile($FileName, $ResName [, $ResType [, $ResLang [, $CreatePath [, $DLL]]]]) Save Resource to File (Requires: #Include <Resources.au3>)
_ResourceSetImageToCtrl($CtrlId, $ResName [, $ResType [, $DLL]]) Set Image to picture control from Resource (Requires: #Include <Resources.au3>)
_SetBitmapToCtrl($CtrlId, $hBitmap) Set Bitmap to a Control (Requires: #Include <Resources.au3>)

Add the following to <au3.userudfs.properties>

au3.keywords.user.udfs=_resourceget _resourcegetasbitmap _resourcegetasbytes _resourcegetasimage _resourcegetasstring \
    _resourcegetasstringw _resourceplaysound _resourcesavetofile _resourcesetimagetoctrl _setbitmaptoctrl \

The UDF is very helpful...Thanks!

-Please edit and re-post if you find any inconsistencies (the descriptions might need changing)

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

  On 3/28/2010 at 8:20 AM, 'guinness said:

For those who use the full version of SciTe and wish for the following commands to show in the command popup box, I have created entries for <au3.user.calltips.api> and <au3.userudfs.properties> (Located in the api and properties folders)

...

Thanks! That's very good idea.

Later I will definitely test it and add it to my first post and to UDF itself.

EDIT: What is purpose of <au3.userudfs.properties>?

Edited by Zedna
Posted

  Quote

What is purpose of <au3.userudfs.properties>?

From what I can gather au3.userudfs.properties is called when you first type the function into SciTe for the initial search and then au3.user.calltips.api is called when you are being more specific to the values of the proposed function.

And I think that the separation from the official au3.api and au3.keywords.properties is useful because I can update SciTe and simply re-copy au3.userudfs.properties & au3.user.calltips.api again.

I got the idea from WinAPIEx and it seemed to work, so I thought I would contribute to the forum.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted

Zedna,

  Quote

What is purpose of <au3.userudfs.properties>?

I seem to remember that Jos added it last year to prevent user-created UDF abbreviations being overwritten when you updated SciTE. The format of the file is identical to the normal properties files and once created it comes up in the SciTE <Options> menu like all the others. :(

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:

  Reveal hidden contents

 

  • 3 weeks later...
Posted (edited)

I have strange problem when I try use recources.au3.

Line 8 (File... resources.au3)
Global Const $RT_CURSOR = 1
Global Const ^ERROR

Error: Can not redeclare a constant.

Even if I Comment string with

$RT_CURSOR = 1
this error exists, but with line number 9 and
Global Const $RT_BITMAP = 2
Edited by VitAl2013
Posted (edited)

  On 4/15/2010 at 11:05 AM, 'VitAl2013 said:

I have strange problem when I try use recources.au3.

Line 8 (File... resources.au3)
Global Const $RT_CURSOR = 1
Global Const ^ERROR

Error: Can not redeclare a constant.

You use another include (or UDF) where these constants are declared too.

Just comment global constants (declared in both of them) in one of these includes.

This is common problem with constants declared in various UDFs

and if you use them together you can easily fix this yourself.

Edited by Zedna

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
  • Recently Browsing   0 members

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