资源dll的用法:
1、编辑*.rc文件内容类似下面的
ActiveLeftTop BITMAP "ActiveLeftTop256.bmp"
ActiveMenubar BITMAP "ActiveMenubar256.bmp"
ActiveRightTop BITMAP "ActiveRightTop256.bmp"
ActiveTop BITMAP "ActiveTop256.bmp"
Bottom BITMAP "Bottom256.bmp"
Close BITMAP "Close256.bmp"
......
2、运行 brcc32 -fo1.res -32 1.rc
1.rc 1.res为文件名
3、新建dll工程,添加上面的资源文件,编译生成test.dll文件
library test;
uses
SysUtils,
Classes;
{$R 1.RES} //加上这一句
begin
end.
4、在你的程序中用下面的方法使用:
var h:THandle;
bmp:TBitmap;
begin
h:=LoadLibrary('test');
if h<=0 then
showMessage('Load Dll Error')
else begin
bmp:=TBitMap.Create;
bmp.Handle:=loadBitmap(h,'ActiveTop');
Image1.Picture.Bitmap.Assign(bmp);
canvas.Draw(0,0,bmp);
bmp.Free;
freeLibrary(h);
end;
end;