Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi Res --> DLL - dcc32 compalieren (https://www.delphipraxis.net/169356-res-dll-dcc32-compalieren.html)

ATS3788 14. Jul 2012 11:11

Res --> DLL - dcc32 compalieren
 
Hallo

Wenn man keine Vollversion von Delphi hat.
also nur die Starter, kann man ja dcc32 nicht benutzen.

Ich müsste aber eine "RES" Ressourcen Datei, automatisch
in eine DLL kompilieren. Habe bei den Kollegen von
http://www.c-plusplus.de
gefragt wie die das machen, leider ohne Feedback.

Wie gesagt ich möchte nur einen DLL Header um die "Res"
Datei packen.
Also brauche ich keine Libraries

Martin Michael

himitsu 14. Jul 2012 21:12

AW: Res --> DLL - dcc32 compalieren
 
Du mußt ja nicht unbedingt den Resouce Compiler von Delphi verwenden. :zwinker:

http://msdn.microsoft.com/en-us/libr.../aa381042.aspx



PS:
Probier mal Folgendes:
Delphi-Quellcode:
{$RESOURCE Dateiname.res Dateiname.rc}


Oder du schaffst via MSDN-Library durchsuchenUpdateResource deine Resourcen nachträglich in die DLL rein.

ATS3788 16. Jul 2012 15:23

AW: Res --> DLL - dcc32 compalieren
 
Danke himitsu

Schaue ich mir an:thumb:

shmia 16. Jul 2012 16:29

AW: Res --> DLL - dcc32 compalieren
 
Oder du nimmst einfach folgende Projektdatei (Text kopieren und als MeineResourcen.dpr abspeichern)
Delphi-Quellcode:
library MeineResourcen;

{$R *.RES}

begin
end.
Dann kopierst du deine RES-Dateien mit in das Verzeichnis und kompilierst mit Delphi.

Du kannst auch RC-Dateien zum Projekt hinzufügen.
Diese werden dann RES-Dateien kompiliert (mit BRCC32.exe) und zur Resourcen-DLL dazugelinkt.

ATS3788 17. Jul 2012 15:31

AW: Res --> DLL - dcc32 compalieren
 
shmia
Zitat:

Nur das wäre ja zu einfach,
wo bleibt da der Spass :)

Das habe ich von C++ umgeschrieben
nur dummerweisse stimmt die grösse nicht bei

SizeofResource(hExe, hRes)


Delphi-Quellcode:
var
hResLoad : HGLOBAL;  // handle to loaded resource
hExe    : HMODULE;      // handle to existing .EXE file
hRes    : HRSRC;        // handle/ptr. to res. info. in hExe
hUpdateRes : THANDLE; // update resource handle
lpResLock : pointer;  // pointer to resource data
result    : BOOL;
begin
// Load the .EXE/.DLL file that contains the ICONs you want to copy.
hExe := LoadLibraryEX('D:\Resource\Debug\Win32\testdll.dll' , 0 , LOAD_LIBRARY_AS_DATAFILE);
if hEXE = 0 then begin
raise Exception.Create('Could not load exe.');
exit;
end;
// Locate the ICON resource
hRes := FindResource(hExe, 'ico1', RT_GROUP_ICON );
if hRes = 0 then begin
  raise Exception.CreateFmt('Could not locate an ICON - %s' , ['ico0']);
    exit;
end;
// Load the ICON into global memory.
hResLoad := LoadResource(hExe, hRes);
if hResLoad = 0 then begin

raise Exception.Create('Could not load Icon.');
    exit;

end;

// Lock the ICON into global memory.
lpResLock := LockResource(hResLoad);
if lpResLock = nil then begin
  raise Exception.Create('Could not lock dialog box.');
    exit;
 end;


// Open the file to which you want to add the ICON resource.
hUpdateRes := BeginUpdateResource('D:\Resource\Debug\Win32\test7.dll' , FALSE);
if hUpdateRes = 0 then begin
     raise Exception.Create('Could not open file for writing.');
    exit;
 end;


 Button1.Caption := IntToStr(SizeofResource(hExe, hRes));

// Add the ICON resource to the update list.
result := UpdateResource(hUpdateRes,   // update resource handle
    RT_GROUP_ICON,                        // change dialog box resource
    'zzy77',                               //yyz77 //MAKEINTRESOURCE(102),
    MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), // neutral language
    lpResLock,                        // ptr to resource info
    SizeofResource(hExe, hRes));      // size of resource info
 if not result then begin
     raise Exception.Create('Could not add resource.');
    exit;
 end;

// Write changes to the dll and then close it.
if not EndUpdateResource(hUpdateRes, FALSE) then begin
     raise Exception.Create('Could not write changes to file.');
    exit
end;
 // Clean up.
if not FreeLibrary(hExe) then begin

  raise Exception.Create('Could not free executable.');
    exit;

end;
Wo bin ich mal wieder blind.
Habe mir das mit ResEdit angeschaut, die Resource wird erstellt
nur leider zu wenig bytes.
Stört euch nicht an dialog box das habe ich noch nicht geändert

ATS3788 17. Jul 2012 16:20

AW: Res --> DLL - dcc32 compalieren
 
http://www.codeguru.com/cpp/w-p/win3...-Resources.htm

Habe da noch was von den C++ Kollegen gefunden, habe wohl ein Problem mit dem header
Habe heute keine Lust mehr.


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:59 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz