Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Meter un txt dentro de un exe (https://www.clubdelphi.com/foros/showthread.php?t=21965)

D@byt 02-06-2005 11:11:49

Meter un txt dentro de un exe
 
¿Puedo incluir un fichero txt dentro de un ejecutable? Si se puede me podría decir alguien la forma para hacerlo.
Gracias a todos.

Neftali [Germán.Estévez] 02-06-2005 11:40:06

Utiliza recursos.
Extracto de un mensaje donde se explica el proceso...

//-------------------------------------------------------
You can store any kind of file as a RCDATA resource.

The following example shows this with an RTF file.

Load RTF file from resource:
Create a file textres.rc:
TESTDOC RCDATA "textdoc.rtf"
Compile this with brcc32 to textres.res.
Include it into your project with an {$R textres.res} line.
Use it similar to this method.

Código Delphi [-]
     procedure TForm1.Button2Click(Sender: TObject); 
     var   
   rs: TResourceStream; 
     Begin   
       rs := TResourceStream.Create( hinstance, 'TESTDOC', RT_
Código Delphi [-]
RCDATA );   
       try     
         richedit1.plaintext :=false;     
         richedit1.lines.loadfromstream(rs);   
       finally     
         rs.free;   
  end;   
     end; 
     

//-------------------------------------------------------


La franja horaria es GMT +2. Ahora son las 22:33:48.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi