Where do I put the logic of my MFC program?
- by Matthew
I created an application core, in C++, that I've compiled into a static library in Visual Studio. I am now at the process of writing a GUI for it.
I am using MFC to do this. I figured out how to map button presses to execute certain methods of my application core's main class (i.e. buttons to have it start and stop).
The core class however, should always be sampling data from an external source every second or two. The GUI should then populate some fields after each sample is taken. I can't seem to find a spot in my MFC objects like CDialog that I can constantly check to see if my class has grabbed the data.. then if it has put that data into some of the text boxes.
A friend suggested that I create a thread on the OnInit() routine that would take care of this, but that solution isn't really working for me.
Is there no spot where I can put an if statement that keeps being called until the program quits?
i.e.
if( coreapp.dataSampleReady() ) {
// put coreapp.dataItem1() in TextBox1
// set progress bar to coreapp.dataItem2()
// etc.
// reset dataSampleReady
}