K
k4-1
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TF_main.Button1Click(Sender: TObject);
var
i,k:integer;
gamelist:Tstringlist;
newitem:Tlistitem;
Iconindex:string;
begin
imagelist1.Handle := ShGetFileInfo('', 0, SHFileInfo, SizeOf(SHFileInfo), SHGFI_LARGEICON or SHGFI_ICON or SHGFI_SYSICONINDEX);
newitem:=nil;
gamelistview.Items.Clear;
gamelist:=Tstringlist.Create;
Try
gamelist.LoadFromFile(extractfilepath(application.ExeName) + 'gamelist.dat');
for i:= 0 to gamelist.Count -1 do
begin
if gamelist [1] =#9 then
newitem.SubItems.add(Trim(gamelist))
else if gamelist[1]=' 'then
Iconindex:=trim(gamelist.Strings);
else
begin
Newitem:=gamelistview.Items.Add;
Newitem.Caption:=gamelist;
newitem.ImageIndex:=getfileiconindex(iconindex);
end;
end;
finally
end;
end;
为什么这段代码每次都不添加gamelist.dat中的最后一项..
var
i,k:integer;
gamelist:Tstringlist;
newitem:Tlistitem;
Iconindex:string;
begin
imagelist1.Handle := ShGetFileInfo('', 0, SHFileInfo, SizeOf(SHFileInfo), SHGFI_LARGEICON or SHGFI_ICON or SHGFI_SYSICONINDEX);
newitem:=nil;
gamelistview.Items.Clear;
gamelist:=Tstringlist.Create;
Try
gamelist.LoadFromFile(extractfilepath(application.ExeName) + 'gamelist.dat');
for i:= 0 to gamelist.Count -1 do
begin
if gamelist [1] =#9 then
newitem.SubItems.add(Trim(gamelist))
else if gamelist[1]=' 'then
Iconindex:=trim(gamelist.Strings);
else
begin
Newitem:=gamelistview.Items.Add;
Newitem.Caption:=gamelist;
newitem.ImageIndex:=getfileiconindex(iconindex);
end;
end;
finally
end;
end;
为什么这段代码每次都不添加gamelist.dat中的最后一项..