I
import
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure BmpToIco(ABmp,AIco:string); var
bmp,mbmp:tbitmap;
ico:ticon;
rbmp:BITMAP;
a:array[0..4096] of byte;
len:dword;
i:integer;
imglist:timagelist;
begin
bmp:=tbitmap.Create;
mbmp:=tbitmap.Create;
mbmp.Assign(bmp);
ico:=ticon.Create;
imglist:=TImageList.CreateSize(32,32);
try
bmp.LoadFromFile(abmp);
len:=GetBitmapBits(bmp.Handle,4096,@a);
mbmp.Handle:=CreateBitmapIndirect(rbmp);
for i:=0 to len do
a:=a and a;
SetBitmapBits(bmp.Handle,len,@a);
imglist.add(bmp,mbmp);
imglist.GetIcon(0,ico);
finally
bmp.Free;
ico.Free;
imglist.Free;
end;
end;
bmp,mbmp:tbitmap;
ico:ticon;
rbmp:BITMAP;
a:array[0..4096] of byte;
len:dword;
i:integer;
imglist:timagelist;
begin
bmp:=tbitmap.Create;
mbmp:=tbitmap.Create;
mbmp.Assign(bmp);
ico:=ticon.Create;
imglist:=TImageList.CreateSize(32,32);
try
bmp.LoadFromFile(abmp);
len:=GetBitmapBits(bmp.Handle,4096,@a);
mbmp.Handle:=CreateBitmapIndirect(rbmp);
for i:=0 to len do
a:=a and a;
SetBitmapBits(bmp.Handle,len,@a);
imglist.add(bmp,mbmp);
imglist.GetIcon(0,ico);
finally
bmp.Free;
ico.Free;
imglist.Free;
end;
end;