Главная страница | назад





Article #16595: Creating a Resource only DLL

 Question and Answer Database
FAQ1595D.txt Creating a Resource only DLL
Category :Miscellaneous
Platform :All
Product :All 32 bit
Question:
How do I create a Resource only DLL?
Answer:
Create and build an empty DLL project, that contains a resource
link reference to the .res file that contains your resources.
Example:
library ResTest;
uses
SysUtils;
{$R MYRES.RES}
begin
end.
To use you resource only DLL, simply load the dll and the
resources
you wish to use:
Example:
{$IFDEF WIN32}
const BadDllLoad = 0;
{$ELSE}
const BadDllLoad = 32;
{$ENDIF}
procedure TForm1.Button1Click(Sender: TObject);
var
h : THandle;
Icon : THandle;
begin
h := LoadLibrary('RESTEST.DLL');
if h <= BadDllLoad then
ShowMessage('Bad Dll Load')
else begin
Icon := LoadIcon(h, 'ICON_1');
DrawIcon(Form1.Canvas.Handle, 10, 10, Icon);
FreeLibrary(h);
end;
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99