whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

43 Visitors Online


 
...use RCDATA resources in Kylix?
Autor: Elias Zurschmiede
Homepage: http://www.delight.ch
[ Print tip ]  

Tip Rating (2):  
     


{
  Resourcedateien (*.res) für Kylix können mit dem Resourcecompiler
  brcc32.exe von Delphi generiert werden.
  Siehe dazu Tip http://www.swissdelphicenter.ch/de/showcode.php?id=1049

  Kylix unterstützt keine benutzerdefinierte Resourcetypen. Deshalb müssen
  alle Resourcen, die keinen vordefinierten ResType haben, als RCDATA
  definiert werden.
  
  Beispiel mit TResourceStream
  Speichert die Resource (in userdefined.res) mit den Namen MYRES1 in die
  Datei test.txt
}

{
  To create resource files (*.res) for Kylix you can use the Delphi
  brcc32.exe resource compiler.
  Take a look at ;http://www.swissdelphicenter.ch/en/showcode.php?id=1049

  
  Kylix dont support userdefined resourcetypes. Therefore you have to define
  all resources without a predefined ResType as RCDATA.
  
  Example with TResourceStream
  Saves the resource (in userdefined.res) with the name MYRES1 to the file
  test.txt
}

uses
  
SysUtils, Types, Classes, Variants, QGraphics, QControls, QForms, QDialogs,
  QStdCtrls;

type
  
TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    
{ Private-Deklarationen }
  
public
    
{ Public-Deklarationen }
  
end;

var
  
Form1: TForm1;

implementation

{$R *.xfm}
{$R userdefined.res}

procedure TForm1.Button1Click(Sender: TObject);
var
  
stream: TResourceStream;
begin
  
stream := TResourceStream.Create(HInstance, 'MYRES1', RT_RCDATA);
  with TFileStream.Create('test.txt', fmCreate) do begin
    
CopyFrom(stream, stream.Size);
    Free;
  end;
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners