解决方案 »

  1.   

    procedure TForm1.itle1Click(Sender: TObject);
    var
      Document: IHTMLDocument2;
    begin
      WebBrowser1.Navigate('www.baidu.com');  while WebBrowser1.busy do
        Application.ProcessMessages;  while WebBrowser1.ReadyState <> READYSTATE_COMPLETE do
        Application.ProcessMessages;
      Document := WebBrowser1.Document as IHTMLDocument2;
      Caption := Document.title;
    end;
      

  2.   

    用Internet控件页的TTcpClient控件速度最快!
    procedure TForm1.Button1Click(Sender: TObject);
    var
      buf: array[0..1023] of Char;
      I, J, K: Integer;
    begin
      TcpClient1.RemoteHost := 'www.baidu.com';
      TcpClient1.RemotePort := '80';
      TcpClient1.Connect;
      buf :=
        'GET / HTTP/1.1'+sLineBreak+
        'UserAgent: Mozilla/3.0 (compatible)'+sLineBreak+
        'Host: www.baidu.com'+sLineBreak+
        'Connection: Close'+sLineBreak+
        sLineBreak;
      TcpClient1.SendBuf(buf, 256);
      buf := '';
      TcpClient1.ReceiveBuf(buf, 1024);
      buf := '';
      TcpClient1.ReceiveBuf(buf, 1024);
      TcpClient1.Disconnect;  for I:=0 to 1023-5 do
        if (buf[I]='<') and (buf[I+1]='t') and (buf[I+2]='i') and (buf[I+3]='t') and (buf[I+4]='l') and (buf[I+5]='e') then
          for J:=I+6 to 1023-5 do
            if buf[J]='>' then
              for K:=J+1 to 1023-5 do
                if buf[K]='<' then
                begin
                  buf[K-(J+1)]:=#0;
                  ShowMessage(Utf8Decode(buf));
                  Exit
                end else
                  buf[K-(J+1)]:=buf[K]
    end;
      

  3.   

    idhttp你感觉不好用,应该是最后返回的编码问题,自己定义一个字符流,然后给返回的字符流设置为UTF8编码就可以了。
      

  4.   

    感谢楼上诸位的回答,怪我没说明白,我用了webbrowser 控件,然后使用IHTMLDocument2(wb1.Document).title这句话就出来了,散分!