473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Pausing and continuing MFC Thread

Hi everyone,
I'm having troubles with pausing and continuing MFC Thread.For test
purposes I've created in my MFC Dialog application a progress Bar
Control, a Start Button and a Stop Button.The idea is to start the
progress Bar Control by clicking on the Start Button and I would like
to pause (Stop Button) the process at anytime and continue it when I
click on the Start Button.I had a look at the following homepage:
http://www.flounder.com/workerthreads.htm and frankly speaking I still
don't understand how:CEvent(CreateEvent), WaitForSingleObject
(WAIT_OBJECT_0), AfxBeginThread, Postmessage, etc... collaborate with
each other.
Here is for example what should occur when one the Start Button
clicks:

void CProgressbarExampleDlg::OnBnStart()
{
int i, count;
count=0;

while(count < 170)
{
for (i=0;i<30;i++)
{
m_ProgressBarCtrl.SetPos(i+10);
Sleep(10);
}
count ++;
}
}

Should the code on the OnBnStart() function be the Workerthread?I
should start it with AfxBeginThread right?Where should I create the
handles for the events to use with WaitForSingleObject?I should
probably need to create two handles (for example mhStopEvent and
mhStartEvent )right? and how should the OnBnStop() function looks
like?
Does anyone have a suggestion?
Thank you
Lucress
Sep 16 '08 #1
3 3877
Lucress Carol wrote:
Hi everyone,
I'm having troubles with pausing and continuing MFC Thread.
You've come in the wrong door, try a windows group.

--
Ian Collins.
Sep 16 '08 #2
On Sep 16, 9:51*am, Ian Collins <ian-n...@hotmail.comwrote:
Lucress Carol wrote:
Hi everyone,
I'm having troubles with pausing and continuing MFC Thread.

You've come in the wrong door, try a windows group.

--
Ian Collins.
I thought I posted at the microsoft.public.vc.language.
Thank you
Lucress
Sep 16 '08 #3
On Sep 16, 10:51*am, Ian Collins <ian-n...@hotmail.comwrote:
Lucress Carol wrote:
Hi everyone,
I'm having troubles with pausing and continuing MFC Thread.

You've come in the wrong door, try a windows group.
OT here.
try this one:
http://groups.google.com/group/micro...c.vc.mfc?hl=en

regards,
FM.
Sep 16 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Simon John | last post by:
I'm writing a PyQt network client for XMMS, using the InetCtrl plugin, that on connection receives a track length. To save on bandwidth, I don't want to be continually querying the server for...
7
by: Dr. Know | last post by:
I am working on an ASP page that writes to several databases, ranging from MDBs to x-base. One of the tasks involves using an existing highest value from the DB and incrementing it before...
1
by: Paul Wistrand | last post by:
I'm hoping that someone can quickly tell me of way to make my concole app pause for a set duration before contining in an infinite loop (e.g. solution to 100% cpu problem). Thanks
2
by: SpookyET | last post by:
How do you pause and resume some work without using Thread.Suspend and Thread.Resume since they are deprecated in .NET 2.0?
7
by: Charles Law | last post by:
My first thought was to call WorkerThread.Suspend but the help cautions against this (for good reason) because the caller has no control over where the thread actually stops, and it might have...
4
by: RSH | last post by:
I am writing a VB .Net App (Not ASP .Net) where I'm having an issue creating a cancel button... I have a situation where I have a loop that is initiated when the user clicks on a Run button. ...
2
by: BLUE | last post by:
I would like to pause an application while the GUI display a Label saying "Logging in...". System.Timers System.Windows.Forms.Timer System.Threading.Timer System.Threading ==Thread.Sleep ...
3
by: =?Utf-8?B?QnJpYW4gU2hhZmVy?= | last post by:
I have a class that opens a login form, I want to wait for feedback from this form before I proform anymore code. How can i do this?
0
by: thesti | last post by:
hello, i have some jbuttons in my frame. and i have a recursive method, which will check a certain condition and if satisfied, will move one of the jbuttons location to somewhere else in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.