Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 21.01.06 20:22 
Hallo,

ich will PNGs in RES-Files speichern und zur Laufzeit auslesen. Ich benutze den PE Resource Explorer. Aber der bietet nur gifs,jpeg oder bmp für Grafiken an. Weiß jemand Rat?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Sa 21.01.06 23:08 
Vielleicht kannst du auch eine PNGImageList benutzen?
www.thany.org/?id=32&ref=18

:wave:
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 21.01.06 23:09 
@Coder: Die RES-Datei hat ja nichts mit einer ImageList zu tun!

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Lossy eX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1048
Erhaltene Danke: 4



BeitragVerfasst: So 22.01.06 09:27 
Du kannst in dem Resource Explorer auch so etwas machen wie "Import User Resource" oder "Import RCData". Wobei RCData in RES Dateien wieder eine andere Kategorie sind.

Als Kategorie gibt es vorgefertigte wie "Bitmap" du kannst aber auch "BMP" oder "PNG" direkt angeben. Das musst du dann beim Laden berücksichtigen. Also dann als Typ nicht RT_BITMAP sondern 'PNG' angeben. Der Parameter ist bewusst ein Pointer. Wer auch immer auf den Scheiß gekommen ist. ;-)

_________________
Nur die Menschheit ist arrogant genug, um zu glauben sie sei die einzige intelligente Lebensform im All. Wo nicht mal das nachhaltig bewiesen wurde.
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 22.01.06 12:37 
Also wähle ich jetzt Import User Resource und dann ein PNG-Bild oder wie meinst du das? :wink:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Lossy eX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1048
Erhaltene Danke: 4



BeitragVerfasst: So 22.01.06 13:56 
Ja genau so meinte ich das. Musste mal ein bisschen rumspielen. Kannst eigentlich nicht viel falsch machen. Wobei ich meine, dass es möglich ist kleine Resourcenamen anzugeben. Was aber nicht funktioniert, da Windows die nicht auslesen kann.

_________________
Nur die Menschheit ist arrogant genug, um zu glauben sie sei die einzige intelligente Lebensform im All. Wo nicht mal das nachhaltig bewiesen wurde.
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 22.01.06 14:06 
user profile iconLossy eX hat folgendes geschrieben:
kleine Resourcenamen


Meinst du 'keine' oder 'kleine'?

Gut, ich habe das jetzt so gemacht. Da steht jetzt links:

PNG --> Abmelden --> Language Neutral

Das Bild heißt Abmelden.png

Jetzt speicher ich das als IMAGES.RES ab. Und wie lese ich das aus? Mit Bitmaps mache ich das so:

ausblenden Delphi-Quelltext
1:
image1.picture.bitmap.loadfromrsourcename(hinstance,'ABMELDEN');					

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Lossy eX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1048
Erhaltene Danke: 4



BeitragVerfasst: Mo 23.01.06 09:10 
Du brauchst dazu eine PNG Bibliothek. Ich benutze dazu gerne die PNG Image oder wie sie jetzt auch genau heißt. Es gibt aber noch eine Bibliothek die auf dieser basiert. Dazu schwirren hier irgendwo auch links rum.

Von dem Resource Explorer gibt es mittlerweile auch eine neue Version. Die heißt dann irgendwie auch XN Resource Explorer. Ich meine als ich ich noch den PN benutzt habe hatte ich mal das Problem, dass er eine Resource perdu nicht laden konnte, weil der Name halt klein geschrieben war. Der XN macht die aber immer groß. Weiß nicht ob er es auch macht, wenn du sie einfach nur öffnest. Aber den Namen solltest du auf jeden Fall noch anpassen. Zur not per Hand.

Und beim Auslesen musst du darauf achten, dass du auch einen Resourcetypen angeben kannst. In deinem Code weiß er genau, dass es sich dabei um ein Bitmap handelt. Wobei Bitmaps natürlich auch 'BMP' als Resourcetypen haben können. Und dann könntest du sie so auch nicht laden. Wobei ich auch gerade sehe, dass die PNG Bibliothek da auch nicht so flexibel ist. Der will standard nur 'RC Data' laden. Also entweder du importierst deine Bilder mit "Import RC Data" oder es wird ein bisschen mehr zu schreiben. Wobei man so was auch auslagern kann.

ausblenden für RC Data
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  PNG: TPNGObject;
begin
  PNG := TPNGObject.Create;
  try
    PNG.LoadFromResourceName(HInstance, 'LENA');
    Image1.Picture.Assign(PNG);
  finally
    PNG.Free;
  end;
end;


ausblenden für alles Andere
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
var
  PNG: TPNGObject;
  RS: TResourceStream;
begin
  PNG := TPNGObject.Create;
  try
    RS := TResourceStream.Create(HInstance, 'LENA', 'PNG');
    try
      PNG.LoadFromStream(RS);
      Image1.Picture.Assign(PNG);
    finally
      RS.Free;
    end;
  finally
    PNG.Free;
  end;
end;

_________________
Nur die Menschheit ist arrogant genug, um zu glauben sie sei die einzige intelligente Lebensform im All. Wo nicht mal das nachhaltig bewiesen wurde.