简体   繁体   中英

BackgroundWorker in VS2010 doesn't run in another thread

I created a WinForm in Visual Studio 2010 (c++), almost the same as this example: http://msdn.microsoft.com/en-us/library/waw3xexc.aspx

but when I click on the button that "lunch" the BackgroundWorker it "stucks" the WinForm, so I can't move it or click on "stop button" for the time the function runs.

The function runs as desired - is returns the expected result, and also the progress bar is ok. It seems that the BackgroundWorker runs in the same thread as the WinForm.

What might be the problem?

Thanks!

I found the problem.

The BackgroundWorker actually runs on another thread but it send Events of update progress too often and those events "lunch" function in the main form - that updates ProgressBar - and this funcion "stucks" the form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM