Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting text into executable file

Status
Not open for further replies.

nanin

Programmer
Aug 29, 2003
13
ES
How can include a text file into an executable file so the application doesn´t have to read from a external file?

How do I obtain the text later?


Thanks!!
 
It is possible in a couple of ways:

1: Add the text to the end of the .EXE-file. This approach requires that you know the exact length of the .EXE itself. The lenght-information can be read in the .EXE file header i believe.

2: Have a known pattern of text and search for that pattern in the file. This limit the possible length but could be handy for keys and such.

There might be limitations to these approches that i does not know but i'v tried the first way and it worked nice, i did however had to compile 2 times, the first time to get the size, then write it in and then compile the final.

Totte
 
And if I add a resource file to the project with the text? does anyone how to do that?
 
Well, i've added some bitmaps from external BMP-files so to add a textfile should be about the same.
I made a .RC file containing:

#include "DUK_Uni_P.rh"
P_CONNECT BITMAP "..\connect.bmp"
P_DISCONN BITMAP "..\disconnect.bmp"

and the "DUK_Uni_P.rh" containing:

#ifndef __DUK_UNI_P_RH__
#define __DUK_UNI_P_RH__
#define P_CONNECT 1000
#define P_DISCONN 1001
#endif

I can now access these resources by using their number 1000 and 1001. In my case i alter the glyph on a speedbutton to one these two bitmaps through a '->LoadFromRecourceID' call.

Totte
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top