Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Resource file question

Posted on 2001-07-03
3
Medium Priority
?
130 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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

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…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

704 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