procedure TForm1.FormCreate(Sender:TObject);
var
iconname:string;
piconame:pchar;
begin
piconame:=stralloc(7);
//建立PCHAR类型的字符串
for idx:=0 to 5 do
begin
wicon[idx]:=ticon.create;//建立TICON型对象
iconname:=’icon’+inttostr(idx);
strpcopy(piconame,iconname);
//将STRING类型转换成PCHAR类型
wicon[idx].handle:=loadicon(hinstance,piconame);
//调用WINDOWSAPI中的LOADICON函数
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/