flat assembler
Message board for the users of flat assembler.

Index > Windows > How to use RT_RCDATA resource data?

Author
Thread Post new topic Reply to topic
alonso



Joined: 06 Aug 2003
Posts: 15
alonso
HI to every body.
I would like to know how can I use data stored as RT_RCDATA in the resource section, I found this code some where in this forum but no explanation on how to use it, can some body please give me an advise on how to read the data stored. Question

section '.rsrc' resource data readable
directory RT_RCDATA, files

resource files,\
01, LANG_NEUTRAL, MyText,\
02, LANG_NEUTRAL, MiscData

fileres MyText, 'MyText.txt'
fileres MiscData, 'sea and beach.jpg'
Post 13 Nov 2003, 03:16
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
Hi alonso,
You need to locate and load your resources using:
Code:
invoke FindResource,[hInstance],01,RT_RCDATA
invoke LoadResource,[hInstance],eax
mov [hData01],eax
    

Your data will be in global memory pointed by hData01.
Post 13 Nov 2003, 10:13
View user's profile Send private message Yahoo Messenger Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex
Alonso,

You can use also the FILE directive to include text and misc. data in your program.

_________________
Code it... That's all...
Post 13 Nov 2003, 10:20
View user's profile Send private message Visit poster's website Reply with quote
alonso



Joined: 06 Aug 2003
Posts: 15
alonso
Pelaillo I tried your code and it worked just fine but it does NOT need the FindResource function since the name you type after fileres contains the handle to the specified resource’s info block (the same returned by FindResource function).

invoke LoadResource, NULL,[MyText]
invoke LockResource, eax
mov [hGlobal],eax ; Pointer to where the data starts
invoke SizeofResource, NULL,[MyText]
mov [dwFileSize], eax ; EAX contains the file size in bytes

section '.rsrc' resource data readable
directory RT_RCDATA, files

resource files,\
01, LANG_NEUTRAL, MyText,\
02, LANG_NEUTRAL, MiscData

fileres MyText, 'MyText.txt'
fileres MiscData, 'mar y isla.jpg'

THANKS TO EVERY BODY!! Smile
Post 13 Nov 2003, 13:20
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.