从网站读取验证码后 如何画到图片框上去

srand((unsigned)time(NULL));  
             int Num = rand();  
            
//请求的地址
              CString getData;
             getData.Format(
"http://ptlogin2.qq.com/getimage?aid=8000201&%d",Num);
       
//请求验证码地址 获取图片数据
        CInternetSession Session;
        CHttpFile
*HttpFile = (CHttpFile*)Session.OpenURL(getData);
       
//图片大小
        DWORD m_len;
       
//获取图片大小
        HttpFile->QueryInfo(HTTP_QUERY_CONTENT_LENGTH,m_len);
       
//图片数组
        char*ch =newchar[m_len];
       
//读取图片
        HttpFile->Read(ch,m_len); //转者注:下载图片跟下载exe文件都是用一样的方法Read,如果下载网页源码就用ReadString

        HttpFile
->Close();
        Session.Close();

转自:http://topic.csdn.net/u/20080629/22/ac613f26-e532-42f5-a630-41a9b135433e.html

posted @ 2012-01-14 20:46  stma  阅读(196)  评论(0)    收藏  举报