views:

15

answers:

1

Hi,

I'm developing in Visual Studio in C++, all managed code. I have a tight processing loop that, theoretically, can run for up to around 30 seconds. During that time, I want the UI to be reactive to any user activity, such as pressing a "Stop" button, or clicking a scroll bar.

I know the technique is to peek at the UI queue (in a non-blocking way) and then, if something's there, react to it, but this is frustrating, because I cracked this problem before, but it was about 4 years ago and I no longer have the code base to refer to.

Anybody out there can help me?

Thanks in advance

+2  A: 

You need to do the processing in a background thread. Check the BackgroundWorker class for example.

klausbyskov
Thank you! Much more elegant solution. :)
DaveP