Using CInternetFile open an Url

Here is code:

        // TODO: Add your control notification handler code here
    CInternetSession InetSession;
    CString strLine;
    CInternetFile *pInetFile = NULL;
    try
    {
        pInetFile = (CInternetFile *)InetSession.OpenURL(_T("https://account.cnblogs.com/signin?returnUrl=https%3A%2F%2Fwww.cnblogs.com%2F"));
    }
    catch (CInternetException *pException)
    {
        pInetFile = NULL;
        pException->Delete();
    }
    char sRecived[1024] = { 0 };
    if (pInetFile)
    {
        while (pInetFile->ReadString((LPTSTR)sRecived, 1024))
        {
            m_Edit2_context+=(CString)sRecived;
        }
        UpdateData(false);
    }    

there would be a bug which will get an unknown context from Url.

End.

猜你喜欢

转载自www.cnblogs.com/lumao1122-Milolu/p/12917601.html