网页文件源码如下:
  <head>
  <meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
    <title>标题</title>
 <STYLE type='text/css'>请问各位,在不打开该文件的情况下,将<title></title>之间的文字提取出来显示在Label中的代码怎样写呢?

解决方案 »

  1.   

    var
      SL: TStringList;
    begin
      SL := TStringList.Create;
      SL.LoadFromFile('filename.htm');
      Label1.Caption := Copy(SL.Text, Pos('<title>', SL.Text) + Length('<title>'), Pos('</title>', SL.Text) - Pos('<title>', SL.Text) - Length('<title>'));
      SL.Free;
    end;
      

  2.   

    User Mshtml(webbrowser1.Document as Ihtmldocument2).title
      

  3.   

    postren(小虫)的方法是对的,不过要频繁读取文件,速度较慢,有没有速度快一点的方法吗?
      

  4.   

    coreblood(菜码♂) 有能好的方法吗?