Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Resource file question

Posted on 2001-07-03
3
Medium Priority
?
133 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 150 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

824 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