|
-
June 1st, 1999, 02:19 PM
#1
Killing the control
I have an activex control that performs a download of some data from our website. Currently the download is done through CHTTPFile and runs in its own thread through the AFXBeginThread call. Here's just a few snipits of code:
void CInstallCtrl: ownload()
{ [SNIP]
while ((bytes = hf->Read(buf, 1024))== 1024)
{
fwrite (buf, 1024, 1, f);
if (m_QUIT) {
hf->Close();
m_READYTOQUIT = TRUE;
AfxEndThread(0);
break; }
}
}
}
void CInstallCtrl::CleanUp()
{
while (1)
{
m_QUIT = TRUE;
Sleep (200);
if (m_READYTOQUIT)
break;
}
}
When a user hits the "X" in the browser I process the "Onunload" and it calls the CleanUp() routine in the control.
The while loop that does the download checks each time for QUIT and if its true sets READYTOQUIT to TRUE and calls AFXEndThread().
Yet the browser locks up when the "X" is hit. Are there any samples I can look at on how to derstory in a multi-threaded ocx?
Thanks!
-Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|