function FileDateSort(List: TStringList; Index1, Index2: Integer): Integer; var dtA, dtB:TDateTime; begin dtA := PFileInfo(List.Objects[Index1])^.dtFileDate; dtB := PFileInfo(List.Objects[Index2])^.dtFileDate; if dtA < dtB then Result := -1 else if dtA = dtB then Result := 0 else Result := 1; end;
----------------------------------------------
武汉天气不好
The order in which this function returns the file names is dependent on the file system type. With NTFS and CDFS file systems, the names are returned in alphabetical order. With FAT file systems, the names are returned in the order the files were written to the disk, which may or may not be in alphabetical order.
var dirArr: TStringDynArray; strdir: String; strList: TStringList; begin dirArr := TDirectory.GetDirectories('D:\Image'); strList := TStringList.Create; strList.Sorted := True; for strdir in dirArr do strList.Add(strdir);
----------------------------------------------
武汉天气不好
var dirArr: TStringDynArray; strdir: String; strList: TStringList; begin dirArr := TDirectory.GetDirectories('D:\Image'); strList := TStringList.Create; strList.Sorted := True; for strdir in dirArr do strList.Add(strdir);
var dirArr: TStringDynArray; strdir: String; strList: TStringList; begin dirArr := TDirectory.GetDirectories('D:\Image'); strList := TStringList.Create; strList.Sorted := True; for strdir in dirArr do strList.Add(strdir); 这个代码,搜索个上千个目录,也用不了一秒吧。
软件的速度问题也是相对的,我一般做的是工业程序,很多时候,达不到某个速度,软件功能就是失败的,比如,要求你传输数据的更新频率是50HZ,你就必须达到这个数值,否则验收就通不过,所以我有时候在写非工业程序的时候,也把速度要求给带进去了。。。
----------------------------------------------
C++ builder 用户前来摸鱼。。。