Mega Code Archive

 
Categories / Delphi / Examples
 

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;