I have a function that run over hours..
I want that on click on a button, this function will start to run, and on click on anoter button (Stop) this function will be stopped (break) – but the problem is that the form become “stuck” when the function is running – and there is no option to click on button Stop.
So how to make the function run without stucking the form?
The second question is how i make the button Stop – how I break a function while it runs (outside the function…)
My reason is to create a new form that will only run the function..and the main form will can close this form while in runs – is there better solution?
thanks!
Read a bit about the concept of threads. WinAPI provides both functions to start new thread and control it, search MSDN for them – creating a new form is not the way to go.