procedure TForm2.FormCreate(Sender: TObject); var {HtmlPath: string; } F:TextFile; s,S1,S2:string; i:Integer; begin //得到TXT路径 s:= (ExtractFilePath(Application.ExeName)+'eMail\')+'eMail.txt'; assignFile(f,s); reset(f); while not eof(f) do begin readln(f,S); i:=Pos('=',S); S1:=Trim(Copy(S,1,I-1));//提取PID S2:=Trim(Copy(S,I+1,length(S)-I)); //提取PWD with Lv1.items.add do begin caption:=IntToStr(lv1.Items.Count); SubItems.Add(S1); if S2='1' then begin //读取并选中项 lv1.Items[lv1.Items.Count-1].Checked:=True; end; end; end; closefile(f); end;