- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

How do I create a Resource only DLL?

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;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile