I want to read some data of an USB Data Acquisition System every 5 milliseconds.
I have created a infinite for loop that reads every 5ms data.
I start the loop with a button (I use MFC) , but when I want to exit the loop with a flag that I want to enable with a stop button, it is not possible to click on some thing.
Can you help me.
Where else should I put my code te read data with an infinite loop? (Now it is under a start button, sow when start button is cliked it stays clicked and I can not click some thing else)
Should I use a flag and how ?
I made my program with visualC++ as an MFC application (CFormView), is there a place in the code that is continously checked so that I can put my infinite loop there with a start and stop flag. (and not under the start button)
Pressing the button should start a timer. You should perform your sample on receipt of WM_TIMER. The timer is inaccurate and can slow down under system load.
It sounds like you've added your code in the button-clicked handler.