UDRes Userlibrary (Userdefined Resources use and compile)
UDRes Userlibrary (Userdefined Resources use and compile)
This library create compiled userdefined resources without another
resource-compiler, without resource-script or temporary files.
The resourcetyp is "PBDATA". Only ID-numbers, no name for the resources.
The resources can automatically packed and unpacked with brieflz. (included
in this library)
This is a good alternate to IncludeBinary. Resources a not loaded
automatically in RAM with exe or dll, other then IncludeBinary.
Only Import the created *.res and use the resource with the functions from
this lib.
English-Help and Examples included.
Download
//edit
New downloadlink
resource-compiler, without resource-script or temporary files.
The resourcetyp is "PBDATA". Only ID-numbers, no name for the resources.
The resources can automatically packed and unpacked with brieflz. (included
in this library)
This is a good alternate to IncludeBinary. Resources a not loaded
automatically in RAM with exe or dll, other then IncludeBinary.
Only Import the created *.res and use the resource with the functions from
this lib.
English-Help and Examples included.
Download
//edit
New downloadlink
Last edited by ts-soft on Sat May 10, 2008 5:19 pm, edited 1 time in total.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Thank you ts-soft, this is very interesting.
I don't know a great deal about resource files. However, I'm working on a large project in which I've created quite a large resource script containing a whole bunch of icons which I then load with LoadIcon_() and display with DrawIconEx_(). Can I still do this with UDRES? My fear is that if I use CatchImage(), this then regards the icon as a bitmap and I lose the ability to display the icon with a transparent background!
I guess I'm asking if there's a way of combining UDRES with my own resource scripts also?
Impressive work nevertheless.
Thanks again.

I don't know a great deal about resource files. However, I'm working on a large project in which I've created quite a large resource script containing a whole bunch of icons which I then load with LoadIcon_() and display with DrawIconEx_(). Can I still do this with UDRES? My fear is that if I use CatchImage(), this then regards the icon as a bitmap and I lose the ability to display the icon with a transparent background!
I guess I'm asking if there's a way of combining UDRES with my own resource scripts also?
Impressive work nevertheless.
Thanks again.
I may look like a mule, but I'm not a complete ass.
@srod
Sorry, in the moment only userdefined resources. The only possible
ResourceType is "PBDATA" (same as RC_DATA, but another name)
I have no information to load it other than as this:
The Resource Header is a dynamic Structure, it's not so easy and the
documentation isn't good, but i will enhance it in the future
So in the moment only Catch from Mem or Save to disk, but all binarys are
no problem (Catch RTF oder LoadLibraryM and so on)
I hope there comes more features in the next releases
Sorry, in the moment only userdefined resources. The only possible
ResourceType is "PBDATA" (same as RC_DATA, but another name)
I have no information to load it other than as this:
Code: Select all
ResName.s = "#" + Str(ResNumber)
hFind = FindResource_(hModule, ResName.s, @"PBDATA")
If hFind
hLoad = LoadResource_(hModule, hFind)
hSize = SizeofResource_(hModule, hFind)
hLock = LockResource_(hLoad)
Mem = AllocateMemory(hSize)
If Mem
CopyMemory(hLock, Mem, hSize)
FreeResource_(hLock)
ProcedureReturn Mem
EndIf
EndIf
documentation isn't good, but i will enhance it in the future

So in the moment only Catch from Mem or Save to disk, but all binarys are
no problem (Catch RTF oder LoadLibraryM and so on)
I hope there comes more features in the next releases
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

I will add extra function for icons (only numbered) and stringtable. Would this
be sufficient?
be sufficient?
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Big problem with icon and so on.
The first off header a long is the datasize, but this is different
Compiled with Porc, this value isn't the FileSize, so i don't know, what is the
DataSize for icons
The first off header a long is the datasize, but this is different

The real DataSize doesn't work, i have no information to change this valueDataSize The size of the data that follows the header. This value does not include any file padding bytes added after the actual data.
The format of the data is different for any of the possible resource types. Data size is expressed in BYTEs (8 bit unsigned integer).
Compiled with Porc, this value isn't the FileSize, so i don't know, what is the
DataSize for icons

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Update
New functions:
Is DLL not loaded, so loadet automatic in memory and unload at programend.
Example:
Also added a threadsafe version as subsystem
Download in first post
regards
Thomas
New functions:
The same Functions as GetFunction in PB, but directly for a DLL in ResourceUDRes_GetFunction
UDRes_GetPackFunction
Is DLL not loaded, so loadet automatic in memory and unload at programend.
Example:
Code: Select all
#PB_DLL = 1
Import "PureBasic.res" : EndImport
CallFunctionFast(UDRes_GetPackFunction(#PB_DLL, "EasyRequester"), "Test")
Download in first post
regards
Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Update
New Functions:
All Catched Sounds, Sprites or Images a only ones in Memory, other than
IncludeBinary!
Download in first post
regards
Thomas
New Functions:
Nearly the same as the catchfunctions in PB, but for UserDefinded ResourcesUDRes_CatchImage
UDRes_CatchPackImage
UDRes_CatchSound
UDRes_CatchPackSound
UDRes_CatchSprite
UDRes_CatchPackSprite
All Catched Sounds, Sprites or Images a only ones in Memory, other than
IncludeBinary!
Download in first post
regards
Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

-
- User
- Posts: 43
- Joined: Wed Jun 28, 2006 6:02 am
SO how do i move from this DLL call to a res file
How do I use UDRes to get rid of this:
then later in the code I do:
so I what changes to both codes and what do I do with UDREs to achieve it?
Thanks
Dan Raymond
[/code]
Code: Select all
OpenLibrary(0,"mt19937ar.dll"); opens random generator library
CallFunction(0, "init_genrand", timeGetTime_()); seed the PRNG
*genrand31 = GetFunction(0, "genrand_int31"); get pointer to function in the dll
Code: Select all
myrandom=mindemand+Int(CallFunctionFast(*genrand31)/#MAXLONG *(maxdemand-mindemand))
Thanks
Dan Raymond
[/code]
Code: Select all
use this for example:
(DLL has Resourcenumber 1 in the example)
Code: Select all
init_genrand = UDRes_GetFunction(1, "init_genrand")
CallFunctionFast(init_genrand, timeGetTime_())
*genrand31 = UDRes_GetFunction(1, "genrand_int31")
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

thankssrod wrote:Excellent work ts-soft.
Thanks.

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Update:
Added 2 Functions
The result is the ModuleHandle. With this, you can load all resources from included DLL
Added 2 Functions
Code: Select all
UDRes_GetModuleHandle(ResNumber.l [, hModule.l])
UDRes_GetPackModuleHandle(ResNumber.l [, hModule.l])
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
