Entwickler-Ecke

Dateizugriff - Ressourcen (*.rs/*.res)


Swordooo - Fr 22.08.08 21:42
Titel: Ressourcen (*.rs/*.res)
Hi an alle,
Da Ressourcen meine Freunde geworden sind, da man nicht den ganzen "Datei-Krempel" mich sich herumschleppen muss, habe ich eine bisher unbeantwortete Frage, oder eher gesagt zwei :lol: :
Welche "Dateitypen" gibt es in *.rc/*.res - Dateien alles? (Ich kann nur BITMAP und WAVE).
Könnte jemand mal eine Liste erstellen o.ä?!

Die andere Frage: Es gibt in Delphi ja eine Grundstrunktur : SaveToFile('Bla').
hier kann man jedoch meines wissen nicht *.res Dateien speichern / erstellen.

Gibt es eine Anweisung o.ä., womit man eine *.res Datei erstellen kann, die dann beim nächsten Programmstert i-wie verwendet wird? (mit SaveToFile kann man ja z.B. *.txt erstellen).

MfG Swordooo


Blackheart666 - Fr 22.08.08 22:17

BITMAP, SOUND, CURSOR, ANICURSOR, RCDATA, ICON, VIDEO, WAVE


Delete - Fr 22.08.08 22:48

Wobei man zu RCDATA noch erwähnen sollte, dass man da alles reinpacken, Texte so wie auch binäre Dateien.


GTA-Place - Sa 23.08.08 02:01

Mir fiel grad auf, dass ich bisher RC_DATA statts RCDATA verwendet habe, aber es trotzdem funktioniert hat. Gibt es da einen Unterschied oder läuft das auf das selbe hinaus :gruebel:

Da bin ich doch glatt zufällig auf eine Liste von Microsoft gestoßen:

ACCELERATORS
Defines menu accelerator keys.
BITMAP
Defines a bitmap by naming it and specifying the name of the file that contains it. (To use a particular bitmap, the application requests it by name.)
CURSOR
Defines a cursor or animated cursor by naming it and specifying the name of the file that contains it. (To use a particular cursor, the application requests it by name.)
DIALOG
Defines a template that an application can use to create dialog boxes.
DIALOGEX
Defines a template that an application can use to create dialog boxes.
FONT
Specifies the name of a file that contains a font.
HTML
Specifies an HTML file.
ICON
Defines an icon or animated icon by naming it and specifying the name of the file that contains it. (To use a particular icon, the application requests it by name.)
MENU
Defines the appearance and function of a menu.
MENUEX
Defines the appearance and function of a menu.
MESSAGETABLE
Defines a message table by naming it and specifying the name of the file that contains it. The file is a binary resource file generated by the message compiler.
POPUP
Defines a menu item that can contain menu items and submenus.
PLUGPLAY
Obsolete.
RCDATA
Defines data resources. Data resources let you include binary data in the executable file.
STRINGTABLE
Defines string resources. String resources are Unicode or ASCII strings that can be loaded from the executable file.
TEXTINCLUDE
A special resource that is interpreted by Visual C++. For more information, see TN035.
TYPELIB
A special resource that is used with the /TLBID and /TLBOUT linker options.
User-Defined Defines a resource that contains application-specific data.
VERSIONINFO
Defines a version-information resource. Contains information such as the version number, intended operating system, and so on.
VXD
Obsolete.


Warum ich die nie über Google gefunden habe wundert mich doch sehr :gruebel: (nur das Stichwort RCDATA hat die Seite geliefert :-|)

=> http://msdn.microsoft.com/en-us/library/aa381043(VS.85).aspx


jaenicke - Sa 23.08.08 16:05

Sofern man nicht in einem Resourceneditor die Typen korrekt erkannt haben möchte, ist man nicht auf spezielle Typangaben angewiesen. Man muss beim Laden lediglich den selben Typ angeben. Beispiel:

Resourcenskript
1:
Beispiel  DATEI  "Testdatei.txt"                    


Auslesen:
1:
  ResStream := TResourceStream.Create(HInstance, 'Beispiel''DATEI');                    


Swordooo - Sa 23.08.08 16:46

Okay, danke.
Wie kann ich aber nun die Textdatei.txt auslesen und z.B. den 1. String im Label anzeigen lassen?


jaenicke - Sa 23.08.08 17:15

Habe ich doch schon geschrieben, einfach einen TResourceStream nehmen und diesen dann mit LoadFromStream benutzen, LoadFromStream gibts zum Beispiel auch bei TStringList.