URLDownloadToFile 应该是把网页下载后需要保存为文件,后还要读取才行吧?使用API函数URLDownloadToFile,从Web服务器下载程序。Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long调用时,可以使用:lReturn = URLDownloadToFile(0, “http://www.abc.com/index.htm”,“c:\index.htm”,0,0) 有没有直接能从函数中返回值到变量的?
这方法,排除了.那么可以用XMLHTTP吧???在VB里,要引用 什么?'引用microsoft activex data object 2.x library '引用microsoft XML,version2.0Dim httpRequest As New MSXML.XMLHTTPRequest httpRequest.Open "POST", "http://localhost/webxml/putinfo.asp", False httpRequest.send strXMLIf httpRequest.Status <> 200 Then MsgBox httpRequest.statusText, , httpRequest.Status Exit Sub End If '以下是判断数据是否正确提交 Dim strretval As String Dim ResponseXml As DOMDocument Set ResponseXml = New DOMDocument Set ResponseXml = httpRequest.ResponseXml '这里返回 strretval = ResponseXml.selectSingleNode("//retval").Text MsgBox strretval
应该是把网页下载后需要保存为文件,后还要读取才行吧?使用API函数URLDownloadToFile,从Web服务器下载程序。Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long调用时,可以使用:lReturn = URLDownloadToFile(0, “http://www.abc.com/index.htm”,“c:\index.htm”,0,0)
有没有直接能从函数中返回值到变量的?
'引用microsoft XML,version2.0Dim httpRequest As New MSXML.XMLHTTPRequest
httpRequest.Open "POST", "http://localhost/webxml/putinfo.asp", False
httpRequest.send strXMLIf httpRequest.Status <> 200 Then
MsgBox httpRequest.statusText, , httpRequest.Status
Exit Sub
End If '以下是判断数据是否正确提交
Dim strretval As String
Dim ResponseXml As DOMDocument
Set ResponseXml = New DOMDocument
Set ResponseXml = httpRequest.ResponseXml '这里返回
strretval = ResponseXml.selectSingleNode("//retval").Text
MsgBox strretval