The project needs to obtain the HTTP webpage content. The chttpsession method is used at the beginning, but it can only be used synchronously. The interface gets stuck when the network speed is slow and the user experience is poor. the asynchronous HTTP method is considered. The Asynchronous Method of winnet is too cumbersome and time cannot be further explored. I suddenly found that the ms itc control could be used in VB, and I thought it could be used in MFC. however, when the execute method is called, parameters will not be passed. The online clear-color VB tutorial has been exploring for a long time. The implementation method is as follows:
1: Associate the control variable m_inetctrl of an ITC.
2: Construct an HTTP request
Tchar * aurl = _ T ("http://www.baidu.com"); _ variant_t url = aurl; _ variant_t method = _ T ("get"); m_intctrl.execute (URL, method, URL, URL );
3: receive in response to the event
If (State = cinet1: icresponsecompleted) {_ variant_t var; long Len = 0; colevariant ret = m_intctrl.getchunk (& Len, VAR); uses_conversion; cstring strlen = ole2a (Ret. bstrval); afxmessagebox (strlen );}
Close the work,
BTW: VC is really troublesome.