C
cory.laflin
Hi. I have what I believe to be a very simple task I'm trying to
accomplish in VC++ 2005 and I simply can't make it work. I have a good
working knowledge of C, a basic-to-middling knowledge of C++, and a
novice-level knowledge of OOP in general and Visual Studio in
particular.
I am not a full-time programmer. I am an aerospace engineer who is
trying to make a useful tool. Remember this.
Anyway, the task breaks down to this. I've made a GUI for one of my
simulator codes. It reads in data from fields and runs the simulator
from that; that all works fine. Here's the problem: I have a Kill
button on the main UI that I need use of while my sim code is running.
The obvious answer would be to put the sim execution in another thread,
leaving the first thread to handle the UI. Problem: There is a
ProgressBar on the UI that needs to update as the simulator moves
through its allotted time. I need this so that the user will know when
the sim is hanging so that s/he can hit the Kill button.
Secondary problem: I also have a message bar that I'd like to update
with a "Simulation finished" message when the case has completed
successfully. This means I need some way for the first thread to know
when the second thread has returned.
I have Googled this subject to death, in these groups, in MSDN, and on
the rest of the Web. I have an 1,100-page book specifically dealing
with VC++ 2005 that says NOTHING, about thread programming. The online
articles I have encountered have either been so simple as to be
worthless in this application, or so complicated as to lose me two
paragraphs in.
This CANNOT, simply CANNOT be a hard thing to do, even for an amateur
programmer, this should be only a step or two beyond a message box with
a "Hello World" and a button. I know there are at least four different
ways to launch threads in a VC++ program: native C++, MFC calls, CLI
Thread classes, and CLI ThreadPool classes. I've tried the last two,
and I'm currently using the last one because it enabled me to actually
pass an argument to it, albeit through a structure that I had to make
specifically for it.
Can somebody please help me?
accomplish in VC++ 2005 and I simply can't make it work. I have a good
working knowledge of C, a basic-to-middling knowledge of C++, and a
novice-level knowledge of OOP in general and Visual Studio in
particular.
I am not a full-time programmer. I am an aerospace engineer who is
trying to make a useful tool. Remember this.
Anyway, the task breaks down to this. I've made a GUI for one of my
simulator codes. It reads in data from fields and runs the simulator
from that; that all works fine. Here's the problem: I have a Kill
button on the main UI that I need use of while my sim code is running.
The obvious answer would be to put the sim execution in another thread,
leaving the first thread to handle the UI. Problem: There is a
ProgressBar on the UI that needs to update as the simulator moves
through its allotted time. I need this so that the user will know when
the sim is hanging so that s/he can hit the Kill button.
Secondary problem: I also have a message bar that I'd like to update
with a "Simulation finished" message when the case has completed
successfully. This means I need some way for the first thread to know
when the second thread has returned.
I have Googled this subject to death, in these groups, in MSDN, and on
the rest of the Web. I have an 1,100-page book specifically dealing
with VC++ 2005 that says NOTHING, about thread programming. The online
articles I have encountered have either been so simple as to be
worthless in this application, or so complicated as to lose me two
paragraphs in.
This CANNOT, simply CANNOT be a hard thing to do, even for an amateur
programmer, this should be only a step or two beyond a message box with
a "Hello World" and a button. I know there are at least four different
ways to launch threads in a VC++ program: native C++, MFC calls, CLI
Thread classes, and CLI ThreadPool classes. I've tried the last two,
and I'm currently using the last one because it enabled me to actually
pass an argument to it, albeit through a structure that I had to make
specifically for it.
Can somebody please help me?