Bild aus DLL laden? (C++ Builder)

fabian24

Mitglied
Hallo Allerseits!
Habe hier ein Problem mit einer DLL: Ich habe eine DLL mit 30 Bildern (24,3 MB), die auf Form1 plaziert sind.
Diese will ich in meine Anwendung laden, weil wenn ich Bilder in meiner Anwendung habe brauch ich ne halbe Ewigkeit zum linken.
Im Moment sieht das ganze so aus:

DLL.cpp :
Code:
void __stdcall BILD(TImage *ZielBild, int Num)
{
if (Num == 1) ZielBild->Picture = Form1->Bild1->Picture;
if (Num == 2) ZielBild->Picture = Form1->Bild2->Picture;
if (Num == 3) ZielBild->Picture = Form1->Bild3->Picture;
if (Num == 4) ZielBild->Picture = Form1->Bild4->Picture;
if (Num == 5) ZielBild->Picture = Form1->Bild5->Picture;
//----------------------------U.S.W.-----------------
}

DLL.h :
Code:
extern "C" __declspec(dllexport) void __stdcall BILD(TImage *ZielBild, int Num)

Anwendung.cpp
Code:
typedef void (*FUNK1) (TImage *ZielBild, int);
void __fastcall TForm1::Button2Click(TObject *Sender)
{
	HINSTANCE DLL;
	FUNK1 Funktion1;
	DLL = LoadLibrary("Projekt1.DLL");
	if (DLL != NULL)
	{
		Funktion1 = (FUNK1) GetProcAddress(DLL, "BILD");
		if (Funktion1 != NULL)
{
		(Funktion1)(Image1, 1);
		}
		if (FreeLibrary(DLL) == true);
	}
}

Kein Fehler keine Warnung nur wenn ich auf Button2 klicke:
"Zugriffsverletzung bei Addresse 00B91A32. Lesen von Adresse 000001C8."

Weiß jemand warum ? Ich hoffe mir kann jemand helfen!
Danke im Voraus!
 
Hallo Allerseits,
Ich habe doch noch die Lösung für mein Problem gefunden.
Für alle die das selbe Problem haben, hab ich es mal in ne ZIP gepackt.
Ich denke wenn man sich die .RC Datei anguckt versteht man ganz schnell wie es geht.

Der erste Parameter ist der Resourcen-Name
Der zweite Parameter ist der Resourcen-Typ
Der zweite Parameter ist der Pfad der einzubindenden Datei.

Gruß Fabian
 

Anhänge

Zurück