Solved

Resource file question

Posted on 2001-07-03
3
122 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now