当前位置: 首页>>代码示例>>C++>>正文


C++ CHttpFile::Close方法代码示例

本文整理汇总了C++中CHttpFile::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ CHttpFile::Close方法的具体用法?C++ CHttpFile::Close怎么用?C++ CHttpFile::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CHttpFile的用法示例。


在下文中一共展示了CHttpFile::Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetFirstGoalUrl

BOOL CProxyIP::GetFirstGoalUrl(const TCHAR* pSrcUrl, TCHAR* pGoalUrl)
{
    BOOL bRet = FALSE;
    CHttpFile* pHttpFile = (CHttpFile *)m_pSession->OpenURL(pSrcUrl);
    DWORD dwStatusCode = 0;
    pHttpFile->QueryInfoStatusCode(dwStatusCode);
    if (dwStatusCode == HTTP_STATUS_OK)
    {
        CString strData;
        wstring subStr = _T("国内网页http代理ip地址服务器");
        while(pHttpFile->ReadString(strData))
        {
            TCHAR mainStr[MAX_STR_LEN] = {0};
            ConvertMultiByteToWideChar((char *)strData.GetBuffer(), mainStr, MAX_STR_LEN);
            wstring wMainStr = mainStr;
            if (wMainStr.find(subStr) < wMainStr.length())
            {
                int startLoc = wMainStr.find(_T("href"));
                int endLoc = wMainStr.find(_T("title"));
                endLoc -= 2;
                startLoc += 6;
                wstring wTempUrl = wMainStr.substr(startLoc, endLoc-startLoc).c_str();
                wmemcpy(pGoalUrl, wTempUrl.c_str(), wcslen(wTempUrl.c_str())+1);
                bRet = TRUE;
                break;
            }
        }
    }
    pHttpFile->Close();
    delete pHttpFile;
    return bRet;
}
开发者ID:yylwuwei,项目名称:HelloWorld,代码行数:32,代码来源:ProxyIP.cpp

示例2: urlGet

std::string urlGet(const char* pUrl)
{
	CInternetSession session(__argv[0]);
	CHttpFile *file = NULL; 	
	CString strHtml = "";   //存放网页数据
	char* headers = "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;)" ;
	try
	{
		file = (CHttpFile*)session.OpenURL(pUrl , 1 , INTERNET_FLAG_TRANSFER_ASCII , headers , strlen(headers)) ;	
	}
	catch(CInternetException * m_pException){
		file = NULL;
		m_pException->Delete();
		session.Close();	
		return "" ;
	}

	CString strLine;
	
	if(file != NULL)
	{
		while(file->ReadString(strLine) != NULL)
		{	
			strHtml += strLine;	
			//strHtml +="\n" ;
		}
		file->Close();
		delete file;
		file = NULL;
	}
	
	session.Close();
	return std::string(strHtml) ;
}
开发者ID:jin1818,项目名称:projectcodesync,代码行数:34,代码来源:impl.cpp

示例3: if

int CXCCRA2MapUpdaterApp::download_update(string link, string fname)
{
	int error = 0;
	CInternetSession is;
	CHttpFile* f = reinterpret_cast<CHttpFile*>(is.OpenURL(link.c_str(), INTERNET_FLAG_TRANSFER_BINARY));
	if (!f)
		error = 1;
	else 
	{
		Cvirtual_file h;
		DWORD status;
		if (!f->QueryInfoStatusCode(status))
			error = 2;
		else if (status != 200)
			error = 3;
		else
		{
			int total_size = f->Seek(0, CFile::end);
			f->Seek(0, CFile::begin);
			Cdownload_dlg dlg;
			dlg.set(link, fname, total_size);
			dlg.Create(Cdownload_dlg::IDD, NULL);
			dlg.EnableWindow(false);
			Cvirtual_binary t;
			while (!error)
			{
				int cb_p = min<int>(f->GetLength(), 1 << 10);
				if (!cb_p)
					break;
				f->Read(t.write_start(cb_p), cb_p);
				h.write(t);
				dlg.set_size(h.size());
				dlg.UpdateWindow();
			}
			h.compact();
			Cxif_key k;
			if (k.load_key(h.data(), h.size()))
				error = 5;
			else
			{
				for (t_xif_key_map::const_iterator ki = k.m_keys.begin(); ki != k.m_keys.end(); ki++)
				{
					if (error)
						break;
					const Cxif_key& l = ki->second;
					string fext = boost::to_lower_copy(Cfname(l.get_value_string(vi_fname)).get_fext());
					if (fext != ".mmx"
						&& (fext != ".yro") || !Cfname(xcc_dirs::get_exe(game_ra2_yr)).exists())
						continue;
					if (file32_write(Cfname(fname).get_path() + l.get_value_string(vi_fname), l.get_value(vi_fdata).get_data(), l.get_value(vi_fdata).get_size()))
						error = 6;
				}
			}
			dlg.DestroyWindow();
		}
		f->Close();
	}
	return error;
}
开发者ID:ChangerR,项目名称:xcc,代码行数:59,代码来源:XCC+RA2+Map+Updater.cpp

示例4:

void C51JobWebPost::TestProxy()
{
	CInternetSession session;

	CHttpFile *file = NULL;   



	INTERNET_PROXY_INFO proxyinfo;

	proxyinfo.dwAccessType = INTERNET_OPEN_TYPE_PROXY;

	proxyinfo.lpszProxy ="122.205.95.14:80";

	proxyinfo.lpszProxyBypass = NULL;

	
	session.SetOption(INTERNET_OPTION_PROXY,(LPVOID)&proxyinfo,
		sizeof(INTERNET_PROXY_INFO));
	
	try{

		file = (CHttpFile*)session.OpenURL("http://www.ip138.com/ip2city.asp",1,
			INTERNET_FLAG_TRANSFER_ASCII|INTERNET_FLAG_RELOAD|INTERNET_FLAG_DONT_CACHE);		

	}catch(CInternetException * m_pException){

		file = NULL;

		m_pException->m_dwError;

		m_pException->Delete();

		session.Close();

		AfxMessageBox("CInternetException");

		return;

	}

	CString strLine;
	CString strResult = "";
	if(file != NULL){

		while(file->ReadString(strLine) != NULL){

			strResult += strLine;

		}

	}else{
		AfxMessageBox("fail");
	}
	file->Close();
	session.Close();
}
开发者ID:wyrover,项目名称:myhistoryprojects,代码行数:57,代码来源:51JobWebPost.cpp

示例5:

int CXCCRA2MapUpdaterApp::update()
{
	int error = 0;
	try
	{
		CWaitCursor wait;
		CInternetSession is;
		CHttpFile* f = reinterpret_cast<CHttpFile*>(is.OpenURL("http://xccu.sourceforge.net/ra2_maps/official.ucf"));
		if (!f)
			error = 1;
		else
		{
			string s;
			while (1)
			{
				int cb_p = f->GetLength();
				if (!cb_p)
					break;
				char* p = new char[cb_p + 1];
				f->Read(p, cb_p);
				p[cb_p] = 0;
				s += p;
				delete[] p;
			}
			f->Close();
			Cvirtual_tfile f;
			f.load_data(Cvirtual_binary(s.c_str(), s.length()));
			while (!f.eof())
			{
				Cmulti_line l = f.read_line();
				Cfname fname = xcc_dirs::get_dir(game_ra2) + l.get_next_line('=') + ".mmx";
				if (!fname.exists())
				{
					string version = l.get_next_line(',');
					string link = l.get_next_line(',');
					error = download_update(link, fname);
					if (error)
					{
						delete_file(fname);
						MessageBox(NULL, "Error retrieving update.", NULL, MB_ICONERROR);
						error = 0;
					}
				}
			}
		}
	}
	catch (CInternetException*)
	{
		error = 1;
	}
	if (error)
		MessageBox(NULL, "Error querying for update.", NULL, MB_ICONERROR);
	return error;
}
开发者ID:ChangerR,项目名称:xcc,代码行数:54,代码来源:XCC+RA2+Map+Updater.cpp

示例6: DownloadFile

BOOL CAutoUpdateDlg::DownloadFile(LPCTSTR lpURL,LPCTSTR lpDestFile)
{
	CFile cUdpFile; 
	if(!cUdpFile.Open(lpDestFile,CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyWrite))
		return FALSE;
	BOOL bResult = FALSE;
	CInternetSession sessionDownload;
	try
	{
		CHttpFile* pFile = (CHttpFile*)sessionDownload.OpenURL(lpURL,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD|INTERNET_FLAG_DONT_CACHE);
		CString   query = _T("");
		pFile->QueryInfo(HTTP_QUERY_CONTENT_LENGTH,query);
		long file_len=_ttol(query);
		m_dwTotalSize = file_len;
		PostMessage(WM_POSMESSAGE,0,0);
		DWORD dwStatus;
		if (pFile->QueryInfoStatusCode(dwStatus))
		{
			if (dwStatus == 200)
			{
				pFile->SetReadBufferSize(10240);
				if (TRUE)
				{
					DWORD dwLen = 0;
					char buf[BLOCKSIZE];
					while (TRUE)
					{
						DWORD dwTemp = pFile->Read(buf,BLOCKSIZE);
						if (dwTemp)
						{
							cUdpFile.Write(buf,dwTemp);
						}
						m_dwDownloadedSize += dwTemp;
						PostMessage(WM_POSMESSAGE,0,0);
						if (dwTemp < BLOCKSIZE)
						{
							break;
						}
					}
				}
			}
		}
		pFile->Close();
		bResult = TRUE;
	}
	catch(CInternetException* pException)
	{
		pException->Delete();
		return bResult;
	}
	sessionDownload.Close();
	cUdpFile.Close();
	return bResult;
}
开发者ID:shzhqiu,项目名称:weibo,代码行数:54,代码来源:AutoUpdateDlg.cpp

示例7: GetHTTPS

UINT CCopiagenda::GetHTTPS(CString csURL, CString csHeaders, CString& csRetHeaders, CString& csRetData)
{
	UINT nCode;

	DWORD dwService;
	CString csServer;
	CString csPath;
	INTERNET_PORT nPort;
	CString csUser;
	CString csPwd;
	AfxParseURLEx(csURL,dwService,csServer,csPath,nPort,csUser,csPwd,0);

	CHttpConnection* pConnection = NULL;
	pConnection=m_pSession->GetHttpConnection(csServer,INTERNET_FLAG_RELOAD|INTERNET_FLAG_DONT_CACHE|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_SECURE,nPort, NULL, NULL);

	if(pConnection)
	{
		BOOL bResult=FALSE;
		CHttpFile* pFile = NULL;
		pFile=pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,csPath,NULL,1,NULL,"HTTP/1.1",INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_RELOAD|INTERNET_FLAG_DONT_CACHE|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_NO_AUTO_REDIRECT|INTERNET_FLAG_SECURE);

		if(pFile)
		{
			try
			{
				bResult=pFile->SendRequest(csHeaders, NULL, 0);
				if(bResult)
				{
					CString csCode;
					pFile->QueryInfo(HTTP_QUERY_STATUS_CODE,csCode);
					nCode=atoi(csCode);

					pFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF,csRetHeaders);

					csRetData=ReadData(pFile);
				}
			}
			catch(CInternetException* e)
			{
			}

			pFile->Close();
			delete pFile;
		}

		pConnection->Close();
		delete pConnection;
	}

	return nCode;
}
开发者ID:ForjaOMF,项目名称:OMF-WindowsMFCSDK,代码行数:51,代码来源:Copiagenda.cpp

示例8: PostHTTP

UINT CMMSSender::PostHTTP(CString csURL, BYTE* strPostData, long lDataSize, CString csHeaders, CString& csRetHeaders, CString& csRetData)
{
	UINT nCode=0;

	DWORD dwService;
	CString csServer;
	CString csPath;
	INTERNET_PORT nPort;
	CString csUser;
	CString csPwd;
	AfxParseURLEx(csURL,dwService,csServer,csPath,nPort,csUser,csPwd,0);

	CHttpConnection* pConnection = NULL;
	pConnection=m_pSession->GetHttpConnection(csServer,0, nPort, NULL, NULL);

	if(pConnection)
	{
		BOOL bResult=FALSE;
		CHttpFile* pFile = NULL;
		pFile=pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST,csPath,NULL,1,NULL,"HTTP/1.1",INTERNET_FLAG_NO_AUTO_REDIRECT);

		if(pFile)
		{
			try
			{
				bResult=pFile->SendRequest(csHeaders, strPostData, lDataSize);
				if(bResult)
				{
					CString csCode;
					pFile->QueryInfo(HTTP_QUERY_STATUS_CODE,csCode);
					nCode=atoi(csCode);

					CString csHeaders;
					pFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF,csRetHeaders);

					csRetData=ReadData(pFile);
				}
			}
			catch(CInternetException* e)
			{
			}

			pFile->Close();
			delete pFile;
		}
		pConnection->Close();
		delete pConnection;
	}

	return nCode;
}
开发者ID:ForjaOMF,项目名称:OMF-WindowsMFCSDK,代码行数:51,代码来源:MMSSender.cpp

示例9: userProfile

DWORD CLoginDlg::userProfile(LPCTSTR serverURL, LPCTSTR requestPage)
{

#ifdef _HTTPS
	CInternetSession session(_T("HelloChat"), INTERNET_FLAG_SECURE);
	CHttpConnection* pConnection = session.GetHttpConnection(serverURL, INTERNET_SERVICE_HTTP, INTERNET_DEFAULT_HTTPS_PORT);
	CString strToken = L"token:";
	strToken = strToken + m_strMyToken + L"\r\n";
	CHttpFile* pFile = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET, requestPage, NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_RELOAD |
		INTERNET_FLAG_DONT_CACHE |
		INTERNET_FLAG_NO_COOKIES);
#else
	CInternetSession session(_T("HelloChat"), PRE_CONFIG_INTERNET_ACCESS);
	CHttpConnection* pConnection = session.GetHttpConnection(serverURL);
	CString strToken = L"token:";
	//strToken = strToken + m_strToken + L"\r\n";
	strToken = strToken + m_strMyToken + L"\r\n";
	CHttpFile* pFile = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET, requestPage, NULL, 1, NULL, NULL, INTERNET_FLAG_RELOAD |
		INTERNET_FLAG_DONT_CACHE |
		INTERNET_FLAG_NO_COOKIES);
#endif

	VERIFY(pFile->AddRequestHeaders(HEADER));
	VERIFY(pFile->AddRequestHeaders(strToken));
	VERIFY(pFile->SendRequest());

	// GET POST STATUS 
	DWORD dwPostStatus = 0;
	VERIFY(pFile->QueryInfoStatusCode(dwPostStatus));
	
	CString strBuffer = L"";
	BOOL brtn = pFile->ReadString(strBuffer);
	char* rtnBuffer = LPSTR(LPCTSTR(strBuffer));

	if (dwPostStatus == HTTP_STATUS_OK)
	{	
		BOOL bRtn = dataParser(rtnBuffer);
		if (!bRtn){
			AfxMessageBox(L"User Info Paser Error");
		}
	}
	else{
		CComm func;
		func.WriteErrorLog(rtnBuffer);
	}
	pFile->Close();

	return dwPostStatus;
}
开发者ID:yuky0312,项目名称:HelloChat,代码行数:49,代码来源:LoginDlg.cpp

示例10: FillGoalUrlVec

BOOL CProxyIP::FillGoalUrlVec(const TCHAR* pFirstGoalUrl)
{
    BOOL bRet = FALSE;
    int totalPage = 0;
    CHttpFile* pHttpFile = (CHttpFile *)m_pSession->OpenURL(pFirstGoalUrl);
    DWORD dwStatusCode = 0;
    pHttpFile->QueryInfoStatusCode(dwStatusCode);
    if (dwStatusCode == HTTP_STATUS_OK)
    {
        BOOL bCheck = FALSE;
        CString strData;
        wstring subStrPage = _T("class=\"pagelist\"");
        while(pHttpFile->ReadString(strData))
        {
            TCHAR mainStr[MAX_STR_LEN] = {0};
            ConvertMultiByteToWideChar((char *)strData.GetBuffer(), mainStr, MAX_STR_LEN);
            wstring wMainStr = mainStr;
            if (bCheck)
            {
                int lenn = wMainStr.find(_T("共"));
                wstring wsPage = wMainStr.substr(lenn+1, 1).c_str();
                totalPage = _wtoi(wsPage.c_str());
                bCheck = FALSE;
                break;
            }

            if (wMainStr.find(subStrPage) < wMainStr.length())
            {
                bCheck = TRUE;
            }

        }

        wstring strGoalUrl = pFirstGoalUrl;
        int lenHtml = strGoalUrl.find(_T(".html"));
        wstring newStrGoalUrl = strGoalUrl.substr(0, lenHtml);
        for (int j = 2; j <= totalPage; j++)
        {
            TCHAR tChar[MAX_URL_LEN] = {0};
            swprintf(tChar, MAX_URL_LEN, _T("%s_%d.html"), newStrGoalUrl.c_str(), j);
            m_goalUrlVec.push_back(tChar);
        }
        bRet = TRUE;
    }
    pHttpFile->Close();
    delete pHttpFile;
    return bRet;
}
开发者ID:yylwuwei,项目名称:HelloWorld,代码行数:48,代码来源:ProxyIP.cpp

示例11: sizeof

CString   C51JobWebPost::GeHttptFile(const   char   *url)   
{   
	CString   szContent;   
	char   strProxyList[MAX_PATH],   strUsername[64],   strPassword[64];   
	//in   this   case   "proxya"   is   the   proxy   server   name,   "8080"   is   its   port   
	strcpy(strProxyList,   "125.41.181.59:8080");     
	strcpy(strUsername,   "myusername");   
	strcpy(strPassword,   "mypassword");   

	DWORD   dwServiceType   =   AFX_INET_SERVICE_HTTP;   
	CString   szServer,   szObject;   
	INTERNET_PORT   nPort;   
	AfxParseURL(url,   dwServiceType,   szServer,   szObject,   nPort);   

	CInternetSession   mysession;   
	CHttpConnection*   pConnection;   
	CHttpFile*   pHttpFile;   
	INTERNET_PROXY_INFO   proxyinfo;   
	proxyinfo.dwAccessType   =   INTERNET_OPEN_TYPE_PROXY;   
	proxyinfo.lpszProxy   =   strProxyList;   
	proxyinfo.lpszProxyBypass   =   NULL;   
	mysession.SetOption(INTERNET_OPTION_PROXY,   (LPVOID)&proxyinfo,   sizeof(INTERNET_PROXY_INFO));  
	pConnection   =   mysession.GetHttpConnection("125.41.181.59",     
		INTERNET_FLAG_KEEP_CONNECTION,   
		8080,   
		NULL,   NULL);   
	pHttpFile   =   pConnection->OpenRequest("GET",url,   
		NULL,   0,   NULL,   NULL,   
		INTERNET_FLAG_KEEP_CONNECTION);   
	
	//here   for   proxy
	 
	//pHttpFile->SetOption(INTERNET_OPTION_PROXY_USERNAME,   strUsername,   strlen(strUsername)+1);   
	//pHttpFile->SetOption(INTERNET_OPTION_PROXY_PASSWORD,   strPassword,   strlen(strPassword)+1);   

	pHttpFile->SendRequest(NULL);   
	DWORD   nFileSize   =   pHttpFile->GetLength();   
	LPSTR   rbuf   =   szContent.GetBuffer(nFileSize);
	UINT   uBytesRead   =   pHttpFile->Read(rbuf,   nFileSize);   
	szContent.ReleaseBuffer();   
	pHttpFile->Close();   
	delete   pHttpFile;   
	pConnection->Close();   
	delete   pConnection;   
	mysession.Close();   
	return   szContent;
}   
开发者ID:wyrover,项目名称:myhistoryprojects,代码行数:47,代码来源:51JobWebPost.cpp

示例12: DownLoadFile

bool CDlgView::DownLoadFile(const string&UrpPath ,const string& strFilePath)
{
    CInternetSession session;
    std::string strHtml;

    try
    {
        CHttpFile* pfile = (CHttpFile*)session.OpenURL(UrpPath.c_str(),1,INTERNET_FLAG_TRANSFER_ASCII|INTERNET_FLAG_RELOAD,NULL,0);

        DWORD dwStatusCode;
        pfile->QueryInfoStatusCode(dwStatusCode);
        if(dwStatusCode == HTTP_STATUS_OK)
        {
            char strBuff[1025] = {0};
            while ((pfile->Read((void*)strBuff, 1024)) > 0)
            {
                strHtml += strBuff;
            }
        }
        else
        {
            return false;
        }

        pfile->Close();
        delete pfile;
        session.Close();
    }
    catch (CException* e)
    {
        e;//消除警告
        return false;
    }

    if (!strHtml.empty())
    {
        ofstream outfile(strFilePath);
        if (!outfile.is_open())
        {
            return false;
        }
        outfile<<strHtml;
        outfile.close();
    }
    return true;
}
开发者ID:SoyPay,项目名称:DacrsUI,代码行数:46,代码来源:DlgView.cpp

示例13: GetSourceHtml

bool CWebpageHandler::GetSourceHtml(CString theUrl,CString fileName)
{
    CInternetSession session;
	CHttpFile *file = NULL; 
	CString strURL = theUrl;
	CString strHtml = _T("");   //存放网页数据 

	try{
		   file = (CHttpFile*)session.OpenURL(strURL);

	}catch(CInternetException * m_pException){
		   file = NULL;
		   m_pException->m_dwError;
		   m_pException->Delete();
		   session.Close();

		   MessageBox(_T("网络连接失败!"));
		   return false;
	}

	CString strLine;
	if(file != NULL){
		   while(file->ReadString(strLine) != NULL){
		   strHtml += strLine;
		   }
 	}else{
		MessageBox(_T("读取网络数据失败!"));
		return false;
	}
 
	CFile file0(fileName, CFile::modeCreate|CFile::modeWrite);
	int len = strHtml.GetLength()*2;
	file0.Write(strHtml, len);
	session.Close();
	file->Close();
	file0.Close();
	delete file;
	file = NULL;

	m_htmlStr = strHtml;
	m_url = theUrl;
	return true;
}
开发者ID:ElvisJazz,项目名称:DesktopCalendar,代码行数:43,代码来源:WebpageHandler.cpp

示例14: FillIpVec

BOOL CProxyIP::FillIpVec()
{
    int i = 0;
    for (i = 0; i < m_goalUrlVec.size(); i++)
    {
        CHttpFile* pHttpFile = (CHttpFile *)m_pSession->OpenURL(m_goalUrlVec[i].c_str());
        DWORD dwStatusCode = 0;
        pHttpFile->QueryInfoStatusCode(dwStatusCode);
        if (dwStatusCode == HTTP_STATUS_OK)
        {
            BOOL bCheck = FALSE;
            CString strData;
            wstring subStr = _T("class=\"cont_ad\"");
            while(pHttpFile->ReadString(strData))
            {
                TCHAR mainStr[MAX_STR_LEN] = {0};
                ConvertMultiByteToWideChar((char *)strData.GetBuffer(), mainStr, MAX_STR_LEN);
                wstring wMainStr = mainStr;
                if (bCheck)
                {
                    if (wMainStr.find(_T("</span>")) < wMainStr.length())
                    {
                        break;
                    }
                    TCHAR firstPosChar = wMainStr.at(0);
                    if (firstPosChar < 48 || firstPosChar > 57)
                    {
                        continue;
                    }
                    m_IpVec.push_back(wMainStr);
                    m_totalIp++;
                }
                if (wMainStr.find(subStr) < wMainStr.length())
                {
                    bCheck = TRUE;
                }
            }
        }
        pHttpFile->Close();
        delete pHttpFile;
    }
    return TRUE;
}
开发者ID:yylwuwei,项目名称:HelloWorld,代码行数:43,代码来源:ProxyIP.cpp

示例15: GetStockInfo

CString  StockRetriever::GetStockInfo(CString url)
{
	CInternetSession inter_session;
	CString strHtml;
	CHttpFile* file =NULL;
	try{  
		file = (CHttpFile*)inter_session.OpenURL(url);  
	}catch(CInternetException * m_pException){  
		file = NULL;  
		m_pException->m_dwError;  
		m_pException->Delete();  
		inter_session.Close();
		return "";
		//AfxMessageBox("CInternetException");  
	}  
	CString strLine;  
	if(file != NULL){  
		while(file->ReadString(strLine) != NULL){  
			strHtml += strLine;  
		}  
	}else{  
		return "";
		//AfxMessageBox("fail");  
	}  
	inter_session.Close();  
	file->Close();  
	delete file;  
	file = NULL;  

	int start = strHtml.Find('"');

	int end = strHtml.Find('"', start+1);

	//ASSERT( end > start+1 );

	if ( ! (end > start+1 && start >0 ))
		return "";

	CString ret = strHtml.Mid(start+1, end-start-1);
	return ret;
}
开发者ID:renyi534,项目名称:stock_proj,代码行数:41,代码来源:StockRetriever.cpp


注:本文中的CHttpFile::Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。