E
ETimeFly
Unregistered / Unconfirmed
GUEST, unregistred user!
我用Delphi写了一个Dll,作用是把一个图标写到文件。然而在其他语言中使用该Dll保存图标后,
图标句柄就变得不可用(比如再用DrawIcon 画图标就出错!!)
Dll源码如下:
library IconDll;
uses
Graphics;
{$R *.res}
type
HICON = type LongWord;
function SaveIconToFile(Icon:HIcon;FileNamechar):Boolean;stdcall;
var
MyIcon:Ticon;
begin
//showmessage(inttostr(icon)+string(FileName)) ;
result:=False;
if(Icon=0)then
exit;//图标句柄为0
try
MyIcon:=Ticon.Create;//初试化
MyIcon.Handle:=Icon;
MyIcon.SaveToFile(string(FileName));
result:=true;
except
MyIcon.Free;
result:=False;
exit;
end;
MyIcon.Free;
end;
//function
exports SaveIconToFile;
begin
end.
图标句柄就变得不可用(比如再用DrawIcon 画图标就出错!!)
Dll源码如下:
library IconDll;
uses
Graphics;
{$R *.res}
type
HICON = type LongWord;
function SaveIconToFile(Icon:HIcon;FileNamechar):Boolean;stdcall;
var
MyIcon:Ticon;
begin
//showmessage(inttostr(icon)+string(FileName)) ;
result:=False;
if(Icon=0)then
exit;//图标句柄为0
try
MyIcon:=Ticon.Create;//初试化
MyIcon.Handle:=Icon;
MyIcon.SaveToFile(string(FileName));
result:=true;
except
MyIcon.Free;
result:=False;
exit;
end;
MyIcon.Free;
end;
//function
exports SaveIconToFile;
begin
end.