Solved

Resource file question

Posted on 2001-07-03
3
126 Views
Last Modified: 2010-04-06
I want to store a text file in my project's resource file and then load the file into a string when needed. How can I do that? I am not too familiar with the resource file'
thanks in advance
jeco
0
Comment
Question by:jeco
3 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6249755
Here is an example with a jpeg image. A txt file works the same:

http://www.gnomehome.demon.nl/uddf/pages/resource.htm#resource1
0
 

Accepted Solution

by:
VanDamM earned 50 total points
ID: 6251113
it's too easy:

1. create a resource script file (*.RC) with a any text editor (for example: myresource.rc)
fill 1 string:
MyText RCDATA "mytext.txt"
where "mytext.txt" your text file filename

2. and run this command in DOS console:
BRCC32 myresource.rc
this will create a resource file (myresources.res)

3. use in your source code
{$R myresources.res}

4. and for load :
var
 ResourceStream : TResourceStream;

begin
ResourceStream := TResourceStream.CreateFromID(HInstance, MyText, RT_RCDATA);

 and use
LoadFromStream(); (LoadFromStream(ResourceStream);)
 for loading into your component

also see LoadFromResourceName & etc
0
 

Author Comment

by:jeco
ID: 6256532
Thanks, that worked great!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 91
select query - oracle 16 101
Firemonkey allowing RTL on android 6 56
Firemonkey Listview item popup menu ? 1 25
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question