Sign in to follow this  
cpp forever

Cancel INTERNET_STATUS_CALLBACK

Recommended Posts

How to cancel the INTERNET_STATUS_CALLBACK function. I want to implement timeout for asynchronous InternetOpenUrl (and then maybe for InternetReadFile() ;) ). I want callback function to stop receiving status codes when I want. Some advices for implementation of this tricky method? :)

Share this post


Link to post
Share on other sites
Try this line of code. This assumes that m_hInternet is the handle returned by InternetOpen().

InternetSetStatusCallback( m_hInternet, NULL );

Share this post


Link to post
Share on other sites
Quote:
Original post by Teric
Try this line of code. This assumes that m_hInternet is the handle returned by InternetOpen().

InternetSetStatusCallback( m_hInternet, NULL );


Knew that. Not a bad idea, but in my example (too much code) I need to create multiple HINTERNETs from InternetOpen() and multiple HINTERNETs from InternetOpenUrl().

Maybe some neat idea?

Share this post


Link to post
Share on other sites
I thought that you could only have one callback defined per internet handle. Thus, if you have multiple handles, you could call InternetSetStatusCallback([Your Handle Here], NULL) for each handle that you have.

Share this post


Link to post
Share on other sites
Quote:
Original post by Teric
I thought that you could only have one callback defined per internet handle. Thus, if you have multiple handles, you could call InternetSetStatusCallback([Your Handle Here], NULL) for each handle that you have.


InternetSetStatusCallback([Your Handle Here], NULL) will probably not work cos MSDN says that callback function must BE. I can use InternetSetStatusCallback([Your Handle Here], NULL) only after InternetCloseHandle().

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this