比如,要获取一个网页的内容,但不想用控件或其它DLL!能否借助API用简单的方法实现呢?

解决方案 »

  1.   

    URLDownloadToFile应该用这个我刚才的是错的
      

  2.   

    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)
    有没有直接能从函数中返回值到变量的?
      

  3.   

    这方法,排除了.那么可以用XMLHTTP吧???在VB里,要引用 什么?
      

  4.   

    用 WINSOCK API ,我记得有人全部用 API 做的下载程序...
      

  5.   

    winsock的api也是来自dll的~否决了~哈哈!用API也就是在用控件!只不过这控件在别人的系统里早安装了~解放思想
      

  6.   

    这方法,排除了.那么可以用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