Autor Beitrag
Thunder00
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52



BeitragVerfasst: Di 14.01.03 18:14 
Hallo,

Ich habe über ein sehr gutes Tutorial von www.delphi-source.de gelernt, wie ich Funktionen in eine DLL packe.

Aber wie packe ich Bitmaps (Bilder) in eine DLL und lese sie später wieder raus in ein TImage.

Ich hab ein Spiel geschrieben, wo ich viele Bitmaps brauche. Und jetz will ich verschiedene Skins über DLLs verwalten.

Gruß,
Andreas 8)

_________________
If you can't make it good, at least make it looks good. (Bill Gates)
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 14.01.03 19:25 
dann schau mal in den tuts von denen oder hier im forum (suche FAQs ect.) wie man mit ressourcen datein umgeht !!!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Thunder00 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52



BeitragVerfasst: Mi 15.01.03 17:24 
Da steht aber nirgends was darüber. Ich hab schon geschaut.

_________________
If you can't make it good, at least make it looks good. (Bill Gates)
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 19.01.03 12:52 
Also du must beim Schreiben deiner DLL die Bilder aus einer .res Datei einbinden:
ausblenden Quelltext
1:
{$R  Name der Datei.RES}					


Um eine .res Datei zu bekommen benötigst du eine .rc Datei, das ist eigentlich eine Textdatei, die wie folgt aufgebaut ist:
NamefürsProgramm Bitmap NamederBitmap.bmp

Mit der Datei brc32.exe im \bin Verzeichnis von Delphi kannst du diese .rc in eine .res verwandeln.

Jetzt musst du die DLL noch Compilieren und schon kannst du dein Bild über NamefürsProgramm ansprechen und laden, etc.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Pierre
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 138

Win 98se und XP prof
D5Pers und D7Prof
BeitragVerfasst: So 19.01.03 12:58 
Hallo,
ich habe noch kein Bild in eine DLL geladen, jedoch schon in eine Ressourcen - Datei. Da ich jedoch schon DLLs geschrieben habe,
würde ich folgenden Weg versuchen:

Du schreibst alle Bildernamen mit Notepad in eine Textdatei, diese hat folgendes Format:

ausblenden Quelltext
1:
2:
100 RCDATA "1.jpg" 
101 RCDATA "2.jpg"

Speichere sie als Bilder.rc ab. Dann compilierst Du sie mit der "brc32.exe" (original in Delphi vorhanden)zu "bilder.res"

Diese bilder.res speicherst Du in den DLL- Projektorder und bindest
mit
ausblenden Quelltext
1:
{$R bilder.res}					

diese Ressource (dort wo Du auch anderes *.res einbindest) in Deine DLL.
Beim Compilieren müßten jetzt die Bilder in die DLL eingebunden werden.
Schreib mal, ob es so geht!
Gruß Pierre
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 19.01.03 14:31 
@Pierre:
Ist das nicht das was ich schon vorgeschlagen hatte?

Ich glaube aber Thunder00 wollte Bitmaps laden und keine .jpg Bildchen. Dann musst du statt RCDATA :arrow: Bitmap reinschreiben.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Thunder00 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52



BeitragVerfasst: So 19.01.03 15:14 
Danke. Ich werds ausprobieren und Meldung machen.
:D

_________________
If you can't make it good, at least make it looks good. (Bill Gates)
Pierre
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 138

Win 98se und XP prof
D5Pers und D7Prof
BeitragVerfasst: So 19.01.03 18:41 
@derDoc,
ich habe die Frage gelesen und wollte drauf antworten, Deine Antwort gab es noch nicht. Beim Schreiben habe ich mir einen Kaffe geholt. Schau mal, Du warst 6 Minuter früher als ich. D.h., Meine Antwort und mein Kaffee hat länger als 6 Minuten gedauert. Da warst Du schon mit Deiner Antwort fertig und hast sie eingestellt.
Gruß Pierre
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 19.01.03 19:20 
@Pierre:
Ich hoffe der Kaffe hat geschmeckt und das sollte kein Vorwurf sein, nur eine Feststellung

Gruß
derDoc

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Thunder00 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52



BeitragVerfasst: Di 21.01.03 21:00 
Funktioniert alles ganz toll mit dem compilieren, nur wie lade ich in ein TImage die Bitmap aus der RES-Datei ??

Ich hab sie über  {$R Bild.res} eingebunden.

Dann hab ich über  Image1.Picture := Bilder probiert die Bitmap anzuzeigen.

Leider ohne Erfolg.

Die RC-Datei sind folgendermaßen aus Bilder Bitmap logo.bmp und heißt Bild.rc

Also alles richtig. Nur wie krieg ich die Bitmap halt in das TImage??

Vielen Dank im Voraus,

_________________
If you can't make it good, at least make it looks good. (Bill Gates)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Di 21.01.03 23:22 
Hallo,

ausblenden Quelltext
1:
Image1.Picture.Bitmap.Handle:=LoadBitmap(hInstance, 'Bilder');					


Anmerkung: hInstance ist schon von Delphi vorbelegt.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)