想通过http的方式下载开了WEB服务的远程计算机上的文件。谁有类似的示例代码?一经提供,立即结贴。

解决方案 »

  1.   

    Download a Web Page
    //this code excerpt also demonstrates how to use //try/catch exception handling
    #include <afxinet.h>
    //assumes server, port and URL names have been initialized
    CInternetSession session("My Session");
    CHttpConnection* pServer = NULL;
    CHttpFile* pFile = NULL;
    try
    {
       CString strServerName;
       INTERNET_PORT nPort;   pServer = session.GetHttpConnection(strServerName, nPort);
       pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET, strObject);
       pFile->AddRequestHeaders(szHeaders);
       pFile->SendRequest();
       pFile->QueryInfoStatusCode(dwRet);   if (dwRet == HTTP_STATUS_OK)
       {
           UINT nRead = pFile->Read(szBuff, 1023);
           while (nRead > 0)
           {
               //read file...
           }
       }
       delete pFile;
       delete pServer;
    }
    catch (CInternetException* pEx)
    {
       //catch errors from WinInet
    }
    session.Close();
      

  2.   

    我也有的很简单的,需要的话就留下mail
      

  3.   

    [email protected]
    也给我一份学习一下!thanks.
      

  4.   

    [email protected]
    我也想要一份,不过不知道能不能是SDK中的!
      

  5.   

    我发这个东西的时候总是被当作垃圾邮件挡回来了,不知道为什么-_-b刚刚又去搜了一下,你们看看这个吧^_^源码
    http://www.vckbase.com/code/network/internet/inet.zip
    文章
    http://www.vckbase.com/document/viewdoc.asp?id=319