Hi, I am using the MFC WinInet classes to retrieve files via HTTP.
I am doing this action in a separate thread, so that the User Interface can remain responsive.
However, I am wondering how I might implement a "Cancel" button for this behavior. A dialog would be displayed during the operation, and the user can click Cancel at any time.
The problem is, how do I cause the operation to stop? The documentation says that TerminateThread should only be used in the most extreme cases. Thus, I'm inclined to believe there's another way.
I have tried testing for a cancel-flag between each step of the operation (e.g., connecting to server, sending the request etc.) but that means the user must wait for that part of the operation to finish.
I'm sure this is possible--I mean, they did it on Internet Explorer for the "Stop" button. Just don't know how to go about doing that.
Thanks in advance.
Will
I REALLY hope that helps.
Will
I am doing this action in a separate thread, so that the User Interface can remain responsive.
However, I am wondering how I might implement a "Cancel" button for this behavior. A dialog would be displayed during the operation, and the user can click Cancel at any time.
The problem is, how do I cause the operation to stop? The documentation says that TerminateThread should only be used in the most extreme cases. Thus, I'm inclined to believe there's another way.
I have tried testing for a cancel-flag between each step of the operation (e.g., connecting to server, sending the request etc.) but that means the user must wait for that part of the operation to finish.
I'm sure this is possible--I mean, they did it on Internet Explorer for the "Stop" button. Just don't know how to go about doing that.
Thanks in advance.
Will
I REALLY hope that helps.
Will