473,545 Members | 1,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Crea teEvent), WaitForSingleOb ject
(WAIT_OBJECT_0) , AfxBeginThread, Postmessage, etc... collaborate with
each other.
Here is for example what should occur when one the Start Button
clicks:

void CProgressbarExa mpleDlg::OnBnSt art()
{
int i, count;
count=0;

while(count < 170)
{
for (i=0;i<30;i++)
{
m_ProgressBarCt rl.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 WaitForSingleOb ject?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 3886
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.co mwrote:
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.publi c.vc.language.
Thank you
Lucress
Sep 16 '08 #3
On Sep 16, 10:51*am, Ian Collins <ian-n...@hotmail.co mwrote:
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
4138
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 updates (e.g. has the current track finished yet?) so I figured the best thing to do is just update after the track length has expired. So, how...
7
7583
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 inserting a new record. I am using Application.Lock and .Unlock together with an application variable to negotiate access to the DB routine to one...
1
2413
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
2497
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
2672
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 a lock pending, for example. I want to be able to stop a thread temporarily, and then optionally resume it or stop it for good.
4
1343
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. I would like to have a Cancel button that when the user clicks it a message button a messagebox will be displayed asking if they would like to...
2
5244
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 Which one? In the last case Sleep must be applied to what(Application, this or what)?
3
1224
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
1302
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 frame and then remove the jbutton from the frame, then the process is repeated. (since i use null layout for my frame, i can call the setBounds...
0
7457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7391
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5962
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5320
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
693
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.