Simple Worker Thread Example

Environment: VC6 SP4, NT4 SP6

This example demonstrates how to start a worker thread from a dialog, keeping the dialog free while running a busy loop in the background. The first of three loops is run from an OnButton event by declaring a variable and calling a function from CloopClass. This is to demonstrate that the dialog can't be moved while the loop is running. The second loop is contained within the thread controller function, which starts after the first loop is done. This allows one to move the dialog while the loop runs. The third loop is created as the first one but from within the worker thread instead of the dialogs OnButton event. The dialog is still free to move while the third loop runs.

Downloads

Download demo project - 25 Kb
Date Posted: 5/17/01


Comments

  • Good Artical

    Posted by Thandava on 05/11/2011 10:52am

    Very Good Artical

    Reply
  • Simple and good demo for the beginners

    Posted by klee777 on 06/12/2009 04:00pm

    Thanks

    Reply
  • ddd

    Posted by Legacy on 05/22/2001 12:00am

    Originally posted by: huxuse

    没什么注解
    

    Reply
  • help-me

    Posted by Legacy on 05/21/2001 12:00am

    Originally posted by: haihong

    dear sir:
    
    resently,I got the sourcecode of Testthread.but the
    sourcecode don't run correctly and display:----------------
    ------------Configuration: LoopClass - Win32 Debug----------------------------------------------------------------------
    Linking...
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/LoopClass.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.

    LoopClass.exe - 4 error(s), 0 warning(s)

    Can you tell me the reason?
    anyway thank you!
    your truely haihong

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 29, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this eSeminar, Gene Kim will discuss these survey findings and will share woeful tales of artifact management gone wrong! Gene will also share examples of how …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds