本帖最后由 ilearn 于 2012-04-19 10:25:07 编辑

解决方案 »

  1.   

    SetLength(Str, Size);
    在D6中也有吧,设置数据大小或字符串长度.
      

  2.   

    procedure TForm1.WinHTTP1HTTPError(Sender: TObject;  ErrorCode: Integer; Stream: TStream);var  Str: String;begin  with Stream as TMemoryStream do   if OutToMemo1.Checked then    begin // Output to Memo1     SetLength(Str, Size);     Move(Memory^, Str[1], Size);     Memo1.Text := Str;    end   else // Save to file    begin     Memo1.Text := 'Saved to c:\httptest.dat';     SaveToFile('c:\httptest.dat');    end;  case ErrorCode of    404: Str := '404: Document not found';    500: Str := '500: CGI script failed';    else // Mysterious reason      Str := IntToStr(ErrorCode);   end;  StatusBar1.Panels[0].Text := 'HTTP Error #' + Str;end;