----赖格英-----

记忆不好了,记录工作中的点点滴滴....

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.添加

uses system.IniFiles

2.实例代码:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,System.IniFiles, Vcl.StdCtrls;
type
  Ps=^string;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    gg:THashedStringList;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  str:string;
  PP:Ps;
  I:Integer;
begin
 gg:=THashedStringList.Create;
 gg.Sort;
 for I := 0 to 500000 do
   begin
     str:=IntToStr(i)+'MM';
     pp:=Addr(str);
     gg.AddObject(IntToStr(i),TObject(Integer(pp)));
     Self.Button1.Caption :=IntToStr(gg.IndexOf(IntToStr(i)));
   end;

end;

end.

本例程在delphi XE6下通过。

posted on 2016-03-16 21:54  向北方  阅读(565)  评论(0编辑  收藏  举报