是XMLHTTP';在VB6中异步工作的s responsebody?

是XMLHTTP';在VB6中异步工作的s responsebody?,vb6,stream,xmlhttprequest,Vb6,Stream,Xmlhttprequest,我们有一个SSRS集成的sharepoint服务器。我正在尝试从中导出PDF格式的报告 (我不得不这样做,因为我的url太长。我宁愿使用Shell命令这样做,尽管这看起来是一个更好的解决方案。) 这是我的密码: Dim request as New XMLHTTP Dim oStream as New Stream Dim aBunchOfMiliseconds as Long Dim fileLocation as String Dim reportUrl as String aBunch

我们有一个SSRS集成的sharepoint服务器。我正在尝试从中导出PDF格式的报告

(我不得不这样做,因为我的url太长。我宁愿使用Shell命令这样做,尽管这看起来是一个更好的解决方案。)

这是我的密码:

Dim request as New XMLHTTP
Dim oStream as New Stream
Dim aBunchOfMiliseconds as Long

Dim fileLocation as String
Dim reportUrl as String

aBunchOfMiliseconds = 500

reportUrl = "http://www.mySharepointDomain.com/_vti_bin/ReportServer?http://www.mySharepointDomain.com/sites/AFolderHere/OOAnotherFolder/BlaBlaReportFolder/FolderFolder/AhTheLastOne/AtLeastMyReportFile.rdl&rs:Command=Render&rc:Toolbar=true&rs:Format=PDF&Parameter1=ABC  &Parameter2=1&Parameter3=1&TheLastParameter=IllBeDamned&rs%3aParameterLanguage=ln-LN"


request.Open "GET", reportUrl
request.setRequestHeader "WWW-Authenticate", "NTLM" 'For impersonation
request.Send 'Go get it Bruce

If request.Status = 200 Then 'Are you successful?

  oStream.Type = adTypeBinary
  oStream.Open

  oStream.Write request.responseBody 'Here's the problematic part
  Sleep(aBunchOfMiliseconds) 'If I don't do this, file will be corrupted

  oStream.SaveToFile fileLocation, adSaveCreateOverWrite

  oStream.Close


End If


Set oStream = Nothing
Set request = Nothing
如果我注释掉“Sleep”行,我将有一个无法打开的损坏文件。这段代码工作得很好,但我发现在那里使用“Sleep”很可笑

有没有办法让我知道数据复制操作已经完成了?

哦,我明白了

我没有说“这不是异步调用”

request.Open "GET", reportUrl, False