Thread paused when switching tasks
I dont know much about threads, so I'm not sure this is the exact cause for my problem. Anyway, I have this upload form type thing in my application which uploads files to my site. When they hit upload, it opens a progress dialog box and in this progress dialog box, I create a thread using CreateThread which points to a function that uploads the files and increases the progress bar. Everything works fine unless the user switches tasks (for example, switching to an open Internet Explorer or whatever else program that they have opened or are opening). Once this happens, the thread pauses (or it seems like it pauses because the progress bar stops and it stops the upload). So my questions are, is what I'm describing possible and if so, how would I fix this? Here is my CreateThread function if that helps:
Code:
DWORD dwID;
HANDLE hThread = CreateThread(NULL, 0, upload_files, hWndDlg, 0, &dwID);
CloseHandle(hThread);
Thanks in advance for any help!!!