wininet异步操作类学习总结[2012/07/11 补充]

网上查了很多资料,也看了很多教程,自己写了一个wininet异步操作类...

多线程使用的还可以,也解决了请求拥堵问题。

 

参照文章:

http://topic.youkuaiyun.com/u/20110126/17/40811C5F-A561-47F9-AEB0-43C9A893F35B.html

http://blog.youkuaiyun.com/cpq37/archive/2010/11/18/6019525.aspx

 

 

WininetAsync.h

 

 

WininetAsync.cpp

 

 

封装到自定义线程类中的成员变量,不使用使用局部对象,防止局部对象失效后依然传递进回调函数导致野指针

 

 

调用

 

 

 

 


补充 - 2012/07/11:

异步调用,如何正常终结回调函数

InternetCloseHandle function

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384350(v=vs.85).aspx

It is safe to call InternetCloseHandle in a callback for the handle being closed. If there is a status callback registered for the handle being closed, and the handle was created with a non-NULL context value, an INTERNET_STATUS_HANDLE_CLOSING callback will be made. This indication will be the last callback made from a handle and indicates that the handle is being destroyed.

 以上代码有2个异步句柄,确保 INTERNET_STATUS_HANDLE_CLOSING 被调用2次后,析构该对象

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值